-*- mode: Pod; buffer-read-only: t -*- !!!!!!! DO NOT EDIT THIS FILE !!!!!!! This file is built by autodoc.pl extracting documentation from the C source files. Any changes made here will be lost! =encoding UTF-8 =head1 NAME perlapi - autogenerated documentation for the perl public API =head1 DESCRIPTION X X X This file contains most of the documentation of the perl public API, as generated by F. Specifically, it is a listing of functions, macros, flags, and variables that may be used by extension writers. Besides L and F, some items are listed here as being actually documented in another pod. L is a list of functions which have yet to be documented. Patches welcome! The interfaces of these are subject to change without notice. Some of the functions documented here are consolidated so that a single entry serves for multiple functions which all do basically the same thing, but have some slight differences. For example, one form might process magic, while another doesn't. The name of each variation is listed at the top of the single entry. But if all have the same signature (arguments and return type) except for their names, only the usage for the base form is shown. If any one of the forms has a different signature (such as returning C or not) every function's signature is explicitly displayed. Anything not listed here or in the other mentioned pods is not part of the public API, and should not be used by extension writers at all. For these reasons, blindly using functions listed in F is to be avoided when writing extensions. In Perl, unlike C, a string of characters may generally contain embedded C characters. Sometimes in the documentation a Perl string is referred to as a "buffer" to distinguish it from a C string, but sometimes they are both just referred to as strings. Note that all Perl API global variables must be referenced with the C prefix. Again, those not listed here are not to be used by extension writers, and may be changed or removed without notice; same with macros. 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. The non-ASCII characters below 256 can have various meanings, depending on various things. (See, most notably, L.) But usually the whole range can be referred to as ISO-8859-1. Often, the term "Latin-1" (or "Latin1") is used as an equivalent for ISO-8859-1. But some people treat "Latin1" as referring just to the characters in the range 128 through 255, or sometimes from 160 through 255. This documentation uses "Latin1" and "Latin-1" to refer to all 256 characters. Note that Perl can be compiled and run under either ASCII or EBCDIC (See L). 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 a different number of bytes than in UTF-8. The organization of this document is tentative and subject to change. Suggestions and patches welcome L. The sections in this document currently are =over 4 =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =item L =back The listing below is alphabetical, case insensitive. =head1 AV Handling =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 AvALLOC(AV* av) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Returns a pointer to the AV's internal SV* array. This is useful for doing pointer arithmetic on the array. If all you need is to look up an array element, then prefer C. =over 3 SV** AvARRAY(AV* av) =back =back =for hackers Found in file av.h =over 4 =item C X Frees all the elements of an array, leaving it empty. The XS equivalent of C<@array = ()>. See also L. Note that it is possible that the actions of a destructor called directly or indirectly by freeing an element of the array could cause the reference count of the array itself to be reduced (e.g. by deleting an entry in the symbol table). So it is a possibility that the AV could have been freed (or even reallocated) on return from the call unless you hold a reference to it. =over 3 void av_clear(AV *av) =back =back =for hackers Found in file av.c =over 4 =item C X Returns the number of elements in the array C. This is the true length of the array, including any undefined elements. It is always the same as S>. =over 3 Size_t av_count(AV *av) =back =back =for hackers Found in file inline.h =over 4 =item C 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: C must be explicitly called as C with an C parameter. =over 3 void Perl_av_create_and_push(pTHX_ AV ** const avp, SV * const val) =back =back =for hackers Found in file av.c =over 4 =item C 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: C must be explicitly called as C with an C parameter. =over 3 SV ** Perl_av_create_and_unshift_one(pTHX_ AV ** const avp, SV * const val) =back =back =for hackers Found in file av.c =over 4 =item C 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. NULL is also returned if C is out of range. Perl equivalent: S> (with the C in void context if C is present). =over 3 SV * av_delete(AV *av, SSize_t key, I32 flags) =back =back =for hackers Found in file av.c =over 4 =item C 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. Perl equivalent: C. =over 3 bool av_exists(AV *av, SSize_t key) =back =back =for hackers Found in file av.c =over 4 =item C X Pre-extend an array so that it is capable of storing values at indexes C<0..key>. Thus C guarantees that the array can store 100 elements, i.e. that C through C on a plain array will work without any further memory allocation. If the av argument is a tied array then will call the C tied array method with an argument of C<(key+1)>. =over 3 void av_extend(AV *av, SSize_t key) =back =back =for hackers Found in file av.c =over 4 =item C X Returns the SV at the specified index in the array. The C is the index. If C 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[$key]>. =over 3 SV ** av_fetch(AV *av, SSize_t key, I32 lval) =back =back =for hackers Found in file av.c =over 4 =item C X Same as C> or C>. =over 3 SSize_t AvFILL(AV* av) =back =back =for hackers Found in file av.h =over 4 =item C X Set the highest index in the array to the given number, equivalent to Perl's S>. The number of elements in the array will be S> after C returns. If the array was previously shorter, then the additional elements appended are set to NULL. If the array was longer, then the excess elements are freed. S> is the same as C. =over 3 void av_fill(AV *av, SSize_t fill) =back =back =for hackers Found in file av.c =over 4 =item C X Same as L. Note that, unlike what the name implies, it returns the maximum index in the array. This is unlike L, which returns what you would expect. B>>. =over 3 SSize_t av_len(AV *av) =back =back =for hackers Found in file av.c =over 4 =item C X Creates a new AV and populates it with a list (C<**strp>, length C) of SVs. A copy is made of each SV, so their refcounts are not changed. The new AV will have a reference count of 1. Perl equivalent: C =over 3 AV * av_make(SSize_t size, SV **strp) =back =back =for hackers Found in file av.c =over 4 =item C X Removes one SV from the end of the array, reducing its size by one and returning the SV (transferring control of one reference count) to the caller. Returns C<&PL_sv_undef> if the array is empty. Perl equivalent: C =over 3 SV * av_pop(AV *av) =back =back =for hackers Found in file av.c =over 4 =item C X Pushes an SV (transferring control of one reference count) onto the end of the array. The array will grow automatically to accommodate the addition. Perl equivalent: C. =over 3 void av_push(AV *av, SV *val) =back =back =for hackers Found in file av.c =over 4 =item C X This is a cut-down version of av_push that assumes that the array is very straightforward - no magic, not readonly, and AvREAL - and that C is not less than -1. This function MUST NOT be used in situations where any of those assumptions may not hold. Pushes an SV (transferring control of one reference count) onto the end of the array. The array will grow automatically to accommodate the addition. Perl equivalent: C. =over 3 void av_push_simple(AV *av, SV *val) =back =back =for hackers Found in file inline.h =over 4 =item C X Removes one SV from the start of the array, reducing its size by one and returning the SV (transferring control of one reference count) to the caller. Returns C<&PL_sv_undef> if the array is empty. Perl equivalent: C =over 3 SV * av_shift(AV *av) =back =back =for hackers Found in file av.c =over 4 =item C X Stores an SV in an array. The array index is specified as C. The return value will be C 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 C that was stored there (= 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 C. Approximate Perl equivalent: C. See L for more information on how to use this function on tied arrays. =over 3 SV ** av_store(AV *av, SSize_t key, SV *val) =back =back =for hackers Found in file av.c =over 4 =item C =item C XX These behave identically. If the array C is empty, these return -1; otherwise they return the maximum value of the indices of all the array elements which are currently defined in C. They process 'get' magic. The Perl equivalent for these is C<$#av>. Use C> to get the number of elements in an array. =over 3 SSize_t av_tindex(AV *av) =back =back =for hackers Found in file av.c =over 4 =item C X Undefines the array. The XS equivalent of C. As well as freeing all the elements of the array (like C), this also frees the memory used by the av to store its list of scalars. See L for a note about the array possibly being invalid on return. =over 3 void av_undef(AV *av) =back =back =for hackers Found in file av.c =over 4 =item C X Unshift the given number of C values onto the beginning of the array. The array will grow automatically to accommodate the addition. Perl equivalent: S> =over 3 void av_unshift(AV *av, SSize_t num) =back =back =for hackers Found in file av.c =over 4 =item C X Returns the AV of the specified Perl global or package array with the given name (so it won't work on lexical variables). 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 (ignoring C) and the variable does not exist then C is returned. Perl equivalent: C<@{"$name"}>. NOTE: the C form is B. =over 3 AV * get_av(const char *name, I32 flags) =back =back =for hackers Found in file perl.c =over 4 =item C =item C =item C XXX These all create a new AV, setting the reference count to 1. If you also know the initial elements of the array with, see L>. As background, an array consists of three things: =over =item 1. A data structure containing information about the array as a whole, such as its size and reference count. =item 2. A C language array of pointers to the individual elements. These are treated as pointers to SVs, so all must be castable to SV*. =item 3. The individual elements themselves. These could be, for instance, SVs and/or AVs and/or HVs, etc. =back An empty array need only have the first data structure, and all these functions create that. They differ in what else they do, as follows: =over =item C form =for comment 'form' above and below is because otherwise have two =items with the same name, can't link to them. This does nothing beyond creating the whole-array data structure. The Perl equivalent is approximately S> This is useful when the minimum size of the array could be zero (perhaps there are likely code paths that will entirely skip using it). If the array does get used, the pointers data structure will need to be allocated at that time. This will end up being done by L>, either explicitly: av_extend(av, len); or implicitly when the first element is stored: (void)av_store(av, 0, sv); Unused array elements are typically initialized by C. =item C form This effectively does a C followed by also allocating (uninitialized) space for the pointers array. This is used when you know ahead of time the likely minimum size of the array. It is more efficient to do this than doing a plain C followed by an C. Of course the array can be extended later should it become necessary. C must be at least 1. =item C form This is C, but initializes each pointer in it to NULL. This gives added safety to guard against them being read before being set. C must be at least 1. =back The following examples all result in an array that can fit four elements (indexes 0 .. 3): AV *av = newAV(); av_extend(av, 3); AV *av = newAV_alloc_x(4); AV *av = newAV_alloc_xz(4); In contrast, the following examples allocate an array that is only guaranteed to fit one element without extending: AV *av = newAV_alloc_x(1); AV *av = newAV_alloc_xz(1); =over 3 AV * newAV () AV * newAV_alloc_x (SSize_t size) AV * newAV_alloc_xz(SSize_t size) =back =back =for hackers Found in file av.h =over 4 =item C X Creates a new AV and populates it with values copied from an existing AV. The new AV will have a reference count of 1, and will contain newly created SVs copied from the original SV. The original source will remain unchanged. Perl equivalent: C =over 3 AV * newAVav(AV *oav) =back =back =for hackers Found in file av.c =over 4 =item C X Creates a new AV and populates it with keys and values copied from an existing HV. The new AV will have a reference count of 1, and will contain newly created SVs copied from the original HV. The original source will remain unchanged. Perl equivalent: C =over 3 AV * newAVhv(HV *ohv) =back =back =for hackers Found in file av.c =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Null AV pointer. (deprecated - use C<(AV *)NULL> instead) =back =for hackers Found in file av.h =head1 Callback Functions XXXXX =over 4 =item C X Performs a callback to the specified named and package-scoped Perl subroutine with C (a C-terminated array of strings) as arguments. See L. Approximate Perl equivalent: C<&{"$sub_name"}(@$argv)>. NOTE: the C form is B. =over 3 I32 call_argv(const char *sub_name, I32 flags, char **argv) =back =back =for hackers Found in file perl.c =over 4 =item C X Performs a callback to the specified Perl method. The blessed object must be on the stack. See L. NOTE: the C form is B. =over 3 I32 call_method(const char *methname, I32 flags) =back =back =for hackers Found in file perl.c =over 4 =item C X Performs a callback to the specified Perl sub. See L. NOTE: the C form is B. =over 3 I32 call_pv(const char *sub_name, I32 flags) =back =back =for hackers Found in file perl.c =over 4 =item C X Performs a callback to the Perl sub specified by the SV. If neither the C nor C flag is supplied, the SV may be any of a CV, a GV, a reference to a CV, a reference to a GV or C will be used as the name of the sub to call. If the C flag is supplied, the SV may be a reference to a CV or C will be used as the name of the method to call. If the C flag is supplied, C will be used as the name of the method to call. Some other values are treated specially for internal use and should not be depended on. See L. NOTE: the C form is B. =over 3 I32 call_sv(SV *sv, volatile I32 flags) =back =back =for hackers Found in file perl.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Opening bracket on a callback. See C> and L. =over 3 ENTER; =back =back =for hackers Found in file scope.h =over 4 =item C X Same as C>, but when debugging is enabled it also associates the given literal string with the new scope. =over 3 ENTER_with_name("name"); =back =back =for hackers Found in file scope.h =over 4 =item C X Tells Perl to C the given string in scalar context and return an SV* result. NOTE: the C form is B. =over 3 SV * eval_pv(const char *p, I32 croak_on_error) =back =back =for hackers Found in file perl.c =over 4 =item C X Tells Perl to C the string in the SV. It supports the same flags as C, with the obvious exception of C. See L. The C flag can be used if you only need eval_sv() to execute code specified by a string, but not catch any errors. NOTE: the C form is B. =over 3 I32 eval_sv(SV *sv, I32 flags) =back =back =for hackers Found in file perl.c =over 4 =item C X Closing bracket for temporaries on a callback. See C> and L. =over 3 FREETMPS; =back =back =for hackers Found in file scope.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlcall.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlcall.pod =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. A backward-compatible version of C which can only return C or C; in a void context, it returns C. Deprecated. Use C instead. =over 3 U32 GIMME =back =back =for hackers Found in file op.h =over 4 =item C 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. =over 3 U32 GIMME_V =back =back =for hackers Found in file op.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlcall.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlcall.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlcall.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlcall.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlcall.pod =over 4 =item C X Returns non-zero if the sub calling this function is being called in an lvalue context. Returns 0 otherwise. =over 3 I32 is_lvalue_sub() =back =back =for hackers Found in file pp_ctl.c =over 4 =item C X Closing bracket on a callback. See C> and L. =over 3 LEAVE; =back =back =for hackers Found in file scope.h =over 4 =item C X Same as C>, but when debugging is enabled it first checks that the scope has the given name. C must be a literal string. =over 3 LEAVE_with_name("name"); =back =back =for hackers Found in file scope.h =over 4 =item C Described in L. =over 3 MORTALDESTRUCTOR_SV(SV *coderef, SV *args) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X This function arranges for either a Perl code reference, or a C function reference to be called at the B. The C argument determines the type of function that will be called. If it is C it is assumed to be a reference to a CV and will arrange for the coderef to be called. If it is not SvROK() then it is assumed to be a C which is C whose value is a pointer to a C function of type C created using C. Either way the C parameter will be provided to the callback as a parameter, although the rules for doing so differ between the Perl and C mode. Normally this function is only used directly for the Perl case and the wrapper C is used for the C function case. When operating in Perl callback mode the C parameter may be NULL in which case the code reference is called with no arguments, otherwise if it is an AV (SvTYPE(args) == SVt_PVAV) then the contents of the AV will be used as the arguments to the code reference, and if it is any other type then the C SV will be provided as a single argument to the code reference. When operating in a C callback mode the C parameter will be passed directly to the C function as a C pointer. No additional processing of the argument will be peformed, and it is the callers responsibility to free the C parameter if necessary. Be aware that there is a signficant difference in timing between the I and the I. If you are looking for a mechanism to trigger a function at the end of the B you should look at C instead of this function. =over 3 void mortal_destructor_sv(SV *coderef, SV *args) =back =back =for hackers Found in file scope.c =over 4 =item C Described in L. =over 3 MORTALDESTRUCTOR_X(DESTRUCTORFUNC_t f, SV *sv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlcall.pod =over 4 =item C =item C XX These each arrange for the value of the array element C to be restored at the end of the enclosing I. In C, the SV at C**sptr> will be replaced by a new C scalar. That scalar will inherit any magic from the original C<**sptr>, and any 'set' magic will be processed. In C, C being set in C causes the function to forgo all that: the scalar at C<**sptr> is untouched. If C is not set, the SV at C**sptr> will be replaced by a new C scalar. That scalar will inherit any magic from the original C<**sptr>. Any 'set' magic will be processed if and only if C is set in in C. =over 3 void save_aelem (AV *av, SSize_t idx, SV **sptr) void save_aelem_flags(AV *av, SSize_t idx, SV **sptr, const U32 flags) =back =back =for hackers Found in file scope.c =over 4 =item C Described in L. =over 3 void save_aptr(AV **aptr) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 AV * save_ary(GV *gv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEBOOL(bool i) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEDELETE(HV * hv, char * key, I32 length) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEDESTRUCTOR(DESTRUCTORFUNC_NOCONTEXT_t f, void *p) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEDESTRUCTOR_X(DESTRUCTORFUNC_t f, void *p) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEFREEOP(OP *op) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEFREEPV(char *pv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEFREERCPV(char *pv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEFREESV(SV* sv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEGENERICSV(char **psv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 HV * save_hash(GV *gv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C =item C XX These each arrange for the value of the hash element (in Perlish terms) C<$hv{key}]> to be restored at the end of the enclosing I. In C, the SV at C**sptr> will be replaced by a new C scalar. That scalar will inherit any magic from the original C<**sptr>, and any 'set' magic will be processed. In C, C being set in C causes the function to forgo all that: the scalar at C<**sptr> is untouched. If C is not set, the SV at C**sptr> will be replaced by a new C scalar. That scalar will inherit any magic from the original C<**sptr>. Any 'set' magic will be processed if and only if C is set in in C. =over 3 void save_helem (HV *hv, SV *key, SV **sptr) void save_helem_flags(HV *hv, SV *key, SV **sptr, const U32 flags) =back =back =for hackers Found in file scope.c =over 4 =item C Described in L. =over 3 void save_hptr(HV **hptr) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEINT(int i) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 void save_item(SV *item) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEIV(IV i) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEI8(I8 i) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEI16(I16 i) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEI32(I32 i) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVELONG(long i) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEMORTALIZESV(SV* sv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVEPPTR(char * p) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVERCPV(char *pv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SV * save_scalar(GV *gv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVESPTR(SV * s) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVESTACK_POS() =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SAVESTRLEN(STRLEN i) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SV * save_svref(SV **sptr) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Opening bracket for temporaries on a callback. See C> and L. =over 3 SAVETMPS; =back =back =for hackers Found in file scope.h =head1 Casting =over 4 =item C X This is a synonym for L>. =over 3 NV Atof(NN const char * const s) =back =back =for hackers Found in file perl.h =over 4 =item C X Cast-to-bool. When Perl was able to be compiled on pre-C99 compilers, a C<(bool)> cast didn't necessarily do the right thing, so this macro was created (and made somewhat complicated to work around bugs in old compilers). Now, many years later, and C99 is used, this is no longer required, but is kept for backwards compatibility. =over 3 bool cBOOL(bool expr) =back =back =for hackers Found in file handy.h =over 4 =item C Described in L. =over 3 type INT2PTR(type, int value) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Cast an NV to IV while avoiding undefined C behavior =over 3 IV I_V(NV what) =back =back =for hackers Found in file perl.h =over 4 =item C X Cast an NV to I32 while avoiding undefined C behavior =over 3 I32 I_32(NV what) =back =back =for hackers Found in file perl.h =over 4 =item C Described in L. =over 3 IV PTR2IV(void * ptr) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 IV PTR2nat(void *) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 NV PTR2NV(void * ptr) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 unsigned long PTR2ul(void *) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 UV PTR2UV(void * ptr) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Cast an NV to UV while avoiding undefined C behavior =over 3 UV U_V(NV what) =back =back =for hackers Found in file perl.h =over 4 =item C X Cast an NV to U32 while avoiding undefined C behavior =over 3 U32 U_32(NV what) =back =back =for hackers Found in file perl.h =head1 Character case changing Perl uses "full" Unicode case mappings. This means that converting a single character to another case may result in a sequence of more than one character. For example, the uppercase of C> (LATIN SMALL LETTER SHARP S) is the two character sequence C. This presents some complications The lowercase of all characters in the range 0..255 is a single character, and thus C> is furnished. But, C can't exist, as it couldn't return a valid result for all legal inputs. Instead C> has an API that does allow every possible legal result to be returned.) Likewise no other function that is crippled by not being able to give the correct results for the full range of possible inputs has been implemented here. =over 4 =item C =item C =item C =item C =item C XXXXX These all return the foldcase of a character. "foldcase" is an internal case for C pattern matching. If the foldcase of character A and the foldcase of character B are the same, they match caselessly; otherwise they don't. The differences in the forms are what domain they operate on, and whether the input is specified as a code point (those forms with a C parameter) or as a UTF-8 string (the others). In the latter case, the code point to use is the first one in the buffer of UTF-8 encoded code points, delineated by the arguments S>. C and C are synonyms of each other. They return the foldcase of any ASCII-range code point. In this range, the foldcase is identical to the lowercase. All other inputs are returned unchanged. Since these are macros, the input type may be any integral one, and the output will occupy the same number of bits as the input. There is no C nor C as the foldcase of some code points in the 0..255 range is above that range or consists of multiple characters. Instead use C. C returns the foldcase of any Unicode code point. The return value is identical to that of C for input code points in the ASCII range. The foldcase of the vast majority of Unicode code points is the same as the code point itself. For these, and for code points above the legal Unicode maximum, this returns the input code point unchanged. It additionally stores the UTF-8 of the result into the buffer beginning at C, and its length in bytes into C<*lenp>. The caller must have made C large enough to contain at least C bytes to avoid possible overflow. NOTE: the foldcase of a code point may be more than one code point. The return value of this function is only the first of these. The entire foldcase is returned in C. To determine if the result is more than a single code point, you can do something like this: uc = toFOLD_uvchr(cp, s, &len); if (len > UTF8SKIP(s)) { is multiple code points } else { is a single code point } C and C are synonyms of each other. The only difference between these and C is that the source for these is encoded in UTF-8, instead of being a code point. It is passed as a buffer starting at C

, with C pointing to one byte beyond its end. The C

buffer may certainly contain more than one code point; but only the first one (up through S>) is examined. If the UTF-8 for the input character is malformed in some way, the program may croak, or the function may return the REPLACEMENT CHARACTER, at the discretion of the implementation, and subject to change in future releases. =over 3 UV toFOLD (UV cp) UV toFOLD_A (UV cp) UV toFOLD_utf8 (U8* p, U8* e, U8* s, STRLEN* lenp) UV toFOLD_utf8_safe(U8* p, U8* e, U8* s, STRLEN* lenp) UV toFOLD_uvchr (UV cp, U8* s, STRLEN* lenp) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXX These all return the lowercase of a character. The differences are what domain they operate on, and whether the input is specified as a code point (those forms with a C parameter) or as a UTF-8 string (the others). In the latter case, the code point to use is the first one in the buffer of UTF-8 encoded code points, delineated by the arguments S>. C and C are synonyms of each other. They return the lowercase of any uppercase ASCII-range code point. All other inputs are returned unchanged. Since these are macros, the input type may be any integral one, and the output will occupy the same number of bits as the input. C and C are synonyms of each other. They behave identically as C for ASCII-range input. But additionally will return the lowercase of any uppercase code point in the entire 0..255 range, assuming a Latin-1 encoding (or the EBCDIC equivalent on such platforms). C returns the lowercase of the input code point according to the rules of the current POSIX locale. Input code points outside the range 0..255 are returned unchanged. C returns the lowercase of any Unicode code point. The return value is identical to that of C for input code points in the 0..255 range. The lowercase of the vast majority of Unicode code points is the same as the code point itself. For these, and for code points above the legal Unicode maximum, this returns the input code point unchanged. It additionally stores the UTF-8 of the result into the buffer beginning at C, and its length in bytes into C<*lenp>. The caller must have made C large enough to contain at least C bytes to avoid possible overflow. NOTE: the lowercase of a code point may be more than one code point. The return value of this function is only the first of these. The entire lowercase is returned in C. To determine if the result is more than a single code point, you can do something like this: uc = toLOWER_uvchr(cp, s, &len); if (len > UTF8SKIP(s)) { is multiple code points } else { is a single code point } C and C are synonyms of each other. The only difference between these and C is that the source for these is encoded in UTF-8, instead of being a code point. It is passed as a buffer starting at C

, with C pointing to one byte beyond its end. The C

buffer may certainly contain more than one code point; but only the first one (up through S>) is examined. If the UTF-8 for the input character is malformed in some way, the program may croak, or the function may return the REPLACEMENT CHARACTER, at the discretion of the implementation, and subject to change in future releases. =over 3 UV toLOWER (UV cp) UV toLOWER_A (UV cp) UV toLOWER_LATIN1 (UV cp) UV toLOWER_LC (UV cp) UV toLOWER_L1 (UV cp) UV toLOWER_utf8 (U8* p, U8* e, U8* s, STRLEN* lenp) UV toLOWER_utf8_safe(U8* p, U8* e, U8* s, STRLEN* lenp) UV toLOWER_uvchr (UV cp, U8* s, STRLEN* lenp) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C XXXXX These all return the titlecase of a character. The differences are what domain they operate on, and whether the input is specified as a code point (those forms with a C parameter) or as a UTF-8 string (the others). In the latter case, the code point to use is the first one in the buffer of UTF-8 encoded code points, delineated by the arguments S>. C and C are synonyms of each other. They return the titlecase of any lowercase ASCII-range code point. In this range, the titlecase is identical to the uppercase. All other inputs are returned unchanged. Since these are macros, the input type may be any integral one, and the output will occupy the same number of bits as the input. There is no C nor C as the titlecase of some code points in the 0..255 range is above that range or consists of multiple characters. Instead use C. C returns the titlecase of any Unicode code point. The return value is identical to that of C for input code points in the ASCII range. The titlecase of the vast majority of Unicode code points is the same as the code point itself. For these, and for code points above the legal Unicode maximum, this returns the input code point unchanged. It additionally stores the UTF-8 of the result into the buffer beginning at C, and its length in bytes into C<*lenp>. The caller must have made C large enough to contain at least C bytes to avoid possible overflow. NOTE: the titlecase of a code point may be more than one code point. The return value of this function is only the first of these. The entire titlecase is returned in C. To determine if the result is more than a single code point, you can do something like this: uc = toTITLE_uvchr(cp, s, &len); if (len > UTF8SKIP(s)) { is multiple code points } else { is a single code point } C and C are synonyms of each other. The only difference between these and C is that the source for these is encoded in UTF-8, instead of being a code point. It is passed as a buffer starting at C

, with C pointing to one byte beyond its end. The C

buffer may certainly contain more than one code point; but only the first one (up through S>) is examined. If the UTF-8 for the input character is malformed in some way, the program may croak, or the function may return the REPLACEMENT CHARACTER, at the discretion of the implementation, and subject to change in future releases. =over 3 UV toTITLE (UV cp) UV toTITLE_A (UV cp) UV toTITLE_utf8 (U8* p, U8* e, U8* s, STRLEN* lenp) UV toTITLE_utf8_safe(U8* p, U8* e, U8* s, STRLEN* lenp) UV toTITLE_uvchr (UV cp, U8* s, STRLEN* lenp) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C XXXXX These all return the uppercase of a character. The differences are what domain they operate on, and whether the input is specified as a code point (those forms with a C parameter) or as a UTF-8 string (the others). In the latter case, the code point to use is the first one in the buffer of UTF-8 encoded code points, delineated by the arguments S>. C and C are synonyms of each other. They return the uppercase of any lowercase ASCII-range code point. All other inputs are returned unchanged. Since these are macros, the input type may be any integral one, and the output will occupy the same number of bits as the input. There is no C nor C as the uppercase of some code points in the 0..255 range is above that range or consists of multiple characters. Instead use C. C returns the uppercase of any Unicode code point. The return value is identical to that of C for input code points in the ASCII range. The uppercase of the vast majority of Unicode code points is the same as the code point itself. For these, and for code points above the legal Unicode maximum, this returns the input code point unchanged. It additionally stores the UTF-8 of the result into the buffer beginning at C, and its length in bytes into C<*lenp>. The caller must have made C large enough to contain at least C bytes to avoid possible overflow. NOTE: the uppercase of a code point may be more than one code point. The return value of this function is only the first of these. The entire uppercase is returned in C. To determine if the result is more than a single code point, you can do something like this: uc = toUPPER_uvchr(cp, s, &len); if (len > UTF8SKIP(s)) { is multiple code points } else { is a single code point } C and C are synonyms of each other. The only difference between these and C is that the source for these is encoded in UTF-8, instead of being a code point. It is passed as a buffer starting at C

, with C pointing to one byte beyond its end. The C

buffer may certainly contain more than one code point; but only the first one (up through S>) is examined. If the UTF-8 for the input character is malformed in some way, the program may croak, or the function may return the REPLACEMENT CHARACTER, at the discretion of the implementation, and subject to change in future releases. =over 3 UV toUPPER (UV cp) UV toUPPER_A (UV cp) UV toUPPER_utf8 (U8* p, U8* e, U8* s, STRLEN* lenp) UV toUPPER_utf8_safe(U8* p, U8* e, U8* s, STRLEN* lenp) UV toUPPER_uvchr (UV cp, U8* s, STRLEN* lenp) =back =back =for hackers Found in file handy.h =head1 Character classification This section is about functions (really macros) that classify characters into types, such as punctuation versus alphabetic, etc. Most of these are analogous to regular expression character classes. (See L.) There are several variants for each class. (Not all macros have all variants; each item below lists the ones valid for it.) None are affected by C, and only the ones with C in the name are affected by the current locale. The base function, e.g., C, takes any signed or unsigned value, treating it as a code point, and returns a boolean as to whether or not the character represented by it is (or on non-ASCII platforms, corresponds to) an ASCII character in the named class based on platform, Unicode, and Perl rules. If the input is a number that doesn't fit in an octet, FALSE is returned. Variant C_A> (e.g., C) is identical to the base function with no suffix C<"_A">. This variant is used to emphasize by its name that only ASCII-range characters can return TRUE. Variant C_L1> imposes the Latin-1 (or EBCDIC equivalent) 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 0xDF, which is a word character in both ASCII and EBCDIC (though it represents different characters in each). If the input is a number that doesn't fit in an octet, FALSE is returned. (Perl's documentation uses a colloquial definition of Latin-1, to include all code points below 256.) Variant C_uvchr> is exactly like the C_L1> variant, for inputs below 256, but if the code point is larger than 255, Unicode rules are used to determine if it is in the character class. For example, C returns TRUE, since 0x100 is LATIN CAPITAL LETTER A WITH MACRON in Unicode, and is a word character. Variants C_utf8> and C_utf8_safe> are like C_uvchr>, but are used for UTF-8 encoded strings. The two forms are different names for the same thing. Each call to one of these classifies the first character of the string starting at C

. The second parameter, C, points to anywhere in the string beyond the first character, up to one byte past the end of the entire string. Although both variants are identical, the suffix C<_safe> in one name emphasizes that it will not attempt to read beyond S>, provided that the constraint S e>> is true (this is asserted for in C<-DDEBUGGING> builds). If the UTF-8 for the input character is malformed in some way, the program may croak, or the function may return FALSE, at the discretion of the implementation, and subject to change in future releases. Variant C_LC> is like the C_A> and C_L1> variants, but the result is based on the current locale, which is what C in the name stands for. If Perl can determine that the current locale is a UTF-8 locale, it uses the published Unicode rules; otherwise, it uses the C library function that gives the named classification. For example, C when not in a UTF-8 locale returns the result of calling C. FALSE is always returned if the input won't fit into an octet. On some platforms where the C library function is known to be defective, Perl changes its result to follow the POSIX standard's rules. Variant C_LC_uvchr> acts exactly like C_LC> for inputs less than 256, but for larger ones it returns the Unicode classification of the code point. Variants C_LC_utf8> and C_LC_utf8_safe> are like C_LC_uvchr>, but are used for UTF-8 encoded strings. The two forms are different names for the same thing. Each call to one of these classifies the first character of the string starting at C

. The second parameter, C, points to anywhere in the string beyond the first character, up to one byte past the end of the entire string. Although both variants are identical, the suffix C<_safe> in one name emphasizes that it will not attempt to read beyond S>, provided that the constraint S e>> is true (this is asserted for in C<-DDEBUGGING> builds). If the UTF-8 for the input character is malformed in some way, the program may croak, or the function may return FALSE, at the discretion of the implementation, and subject to change in future releases. =over 4 =item C =item C =item C =item C XXXX These are each a synonym for their respectively named L> variant. They are provided for backward compatibility, even though a word character includes more than the standard C language meaning of alphanumeric. To get the C language definition, use the corresponding L> variant. =over 3 bool isALNUM(UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C XXXXX These are discouraged, backward compatibility macros for L>. That is, each returns a boolean indicating whether the specified character is one of C<[A-Za-z0-9]>, analogous to C. The C suffix in the names was meant to indicate that they correspond to the C language L>. =over 3 bool isALNUMC(UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified input is one of C<[A-Za-z]>, analogous to C. See the L for an explanation of the variants. =over 3 bool isALPHA (UV ch) bool isALPHA_A (UV ch) bool isALPHA_LC (UV ch) bool isALPHA_LC_utf8_safe(U8 * s, U8 *end) bool isALPHA_LC_uvchr (UV ch) bool isALPHA_L1 (UV ch) bool isALPHA_utf8 (U8 * s, U8 * end) bool isALPHA_utf8_safe (U8 * s, U8 * end) bool isALPHA_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is one of C<[A-Za-z0-9]>, analogous to C. See the L for an explanation of the variants. =over 3 bool isALPHANUMERIC (UV ch) bool isALPHANUMERIC_A (UV ch) bool isALPHANUMERIC_LC (UV ch) bool isALPHANUMERIC_LC_utf8_safe(U8 * s, U8 *end) bool isALPHANUMERIC_LC_uvchr (UV ch) bool isALPHANUMERIC_L1 (UV ch) bool isALPHANUMERIC_utf8 (U8 * s, U8 * end) bool isALPHANUMERIC_utf8_safe (U8 * s, U8 * end) bool isALPHANUMERIC_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is one of the 128 characters in the ASCII character set, analogous to C. On non-ASCII platforms, it returns TRUE iff this character corresponds to an ASCII character. Variants C and C are identical to C. See the L for an explanation of the variants. Note, however, that some platforms do not have the C library routine C. In these cases, the variants whose names contain C are the same as the corresponding ones without. Also note, that because all ASCII characters are UTF-8 invariant (meaning they have the exact same representation (always a single byte) whether encoded in UTF-8 or not), C will give the correct results when called with any byte in any string encoded or not in UTF-8. And similarly C and C will work properly on any string encoded or not in UTF-8. =over 3 bool isASCII (UV ch) bool isASCII_A (UV ch) bool isASCII_LC (UV ch) bool isASCII_LC_utf8_safe(U8 * s, U8 *end) bool isASCII_LC_uvchr (UV ch) bool isASCII_L1 (UV ch) bool isASCII_utf8 (U8 * s, U8 * end) bool isASCII_utf8_safe (U8 * s, U8 * end) bool isASCII_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a character considered to be a blank, analogous to C. See the L for an explanation of the variants. Note, however, that some platforms do not have the C library routine C. In these cases, the variants whose names contain C are the same as the corresponding ones without. =over 3 bool isBLANK (UV ch) bool isBLANK_A (UV ch) bool isBLANK_LC (UV ch) bool isBLANK_LC_utf8_safe(U8 * s, U8 *end) bool isBLANK_LC_uvchr (UV ch) bool isBLANK_L1 (UV ch) bool isBLANK_utf8 (U8 * s, U8 * end) bool isBLANK_utf8_safe (U8 * s, U8 * end) bool isBLANK_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a control character, analogous to C. See the L for an explanation of the variants. On EBCDIC platforms, you almost always want to use the C variant. =over 3 bool isCNTRL (UV ch) bool isCNTRL_A (UV ch) bool isCNTRL_LC (UV ch) bool isCNTRL_LC_utf8_safe(U8 * s, U8 *end) bool isCNTRL_LC_uvchr (UV ch) bool isCNTRL_L1 (UV ch) bool isCNTRL_utf8 (U8 * s, U8 * end) bool isCNTRL_utf8_safe (U8 * s, U8 * end) bool isCNTRL_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a digit, analogous to C. Variants C and C are identical to C. See the L for an explanation of the variants. =over 3 bool isDIGIT (UV ch) bool isDIGIT_A (UV ch) bool isDIGIT_LC (UV ch) bool isDIGIT_LC_utf8_safe(U8 * s, U8 *end) bool isDIGIT_LC_uvchr (UV ch) bool isDIGIT_L1 (UV ch) bool isDIGIT_utf8 (U8 * s, U8 * end) bool isDIGIT_utf8_safe (U8 * s, U8 * end) bool isDIGIT_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a graphic character, analogous to C. See the L for an explanation of the variants. =over 3 bool isGRAPH (UV ch) bool isGRAPH_A (UV ch) bool isGRAPH_LC (UV ch) bool isGRAPH_LC_utf8_safe(U8 * s, U8 *end) bool isGRAPH_LC_uvchr (UV ch) bool isGRAPH_L1 (UV ch) bool isGRAPH_utf8 (U8 * s, U8 * end) bool isGRAPH_utf8_safe (U8 * s, U8 * end) bool isGRAPH_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character can be the second or succeeding character of an identifier. This is very close to, but not quite the same as the official Unicode property C. The difference is that this returns true only if the input character also matches L. See the L for an explanation of the variants. =over 3 bool isIDCONT (UV ch) bool isIDCONT_A (UV ch) bool isIDCONT_LC (UV ch) bool isIDCONT_LC_utf8_safe(U8 * s, U8 *end) bool isIDCONT_LC_uvchr (UV ch) bool isIDCONT_L1 (UV ch) bool isIDCONT_utf8 (U8 * s, U8 * end) bool isIDCONT_utf8_safe (U8 * s, U8 * end) bool isIDCONT_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character can be the first character of an identifier. This is very close to, but not quite the same as the official Unicode property C. The difference is that this returns true only if the input character also matches L. See the L for an explanation of the variants. =over 3 bool isIDFIRST (UV ch) bool isIDFIRST_A (UV ch) bool isIDFIRST_LC (UV ch) bool isIDFIRST_LC_utf8_safe(U8 * s, U8 *end) bool isIDFIRST_LC_uvchr (UV ch) bool isIDFIRST_L1 (UV ch) bool isIDFIRST_utf8 (U8 * s, U8 * end) bool isIDFIRST_utf8_safe (U8 * s, U8 * end) bool isIDFIRST_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a lowercase character, analogous to C. See the L for an explanation of the variants =over 3 bool isLOWER (UV ch) bool isLOWER_A (UV ch) bool isLOWER_LC (UV ch) bool isLOWER_LC_utf8_safe(U8 * s, U8 *end) bool isLOWER_LC_uvchr (UV ch) bool isLOWER_L1 (UV ch) bool isLOWER_utf8 (U8 * s, U8 * end) bool isLOWER_utf8_safe (U8 * s, U8 * end) bool isLOWER_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C XXX Returns a boolean indicating whether the specified character is an octal digit, [0-7]. The only two variants are C and C; each is identical to C. =over 3 bool isOCTAL(UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a printable character, analogous to C. See the L for an explanation of the variants. =over 3 bool isPRINT (UV ch) bool isPRINT_A (UV ch) bool isPRINT_LC (UV ch) bool isPRINT_LC_utf8_safe(U8 * s, U8 *end) bool isPRINT_LC_uvchr (UV ch) bool isPRINT_L1 (UV ch) bool isPRINT_utf8 (U8 * s, U8 * end) bool isPRINT_utf8_safe (U8 * s, U8 * end) bool isPRINT_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX (short for Posix Space) Starting in 5.18, this is identical in all its forms to the corresponding C macros. The locale forms of this macro are identical to their corresponding C forms in all Perl releases. In releases prior to 5.18, the non-locale forms differ from their C forms only in that the C forms don't match a Vertical Tab, and the C forms do. Otherwise they are identical. Thus this macro is analogous to what C matches in a regular expression. See the L for an explanation of the variants. =over 3 bool isPSXSPC (UV ch) bool isPSXSPC_A (UV ch) bool isPSXSPC_LC (UV ch) bool isPSXSPC_LC_utf8_safe(U8 * s, U8 *end) bool isPSXSPC_LC_uvchr (UV ch) bool isPSXSPC_L1 (UV ch) bool isPSXSPC_utf8 (U8 * s, U8 * end) bool isPSXSPC_utf8_safe (U8 * s, U8 * end) bool isPSXSPC_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a punctuation character, analogous to C. Note that the definition of what is punctuation isn't as straightforward as one might desire. See L for details. See the L for an explanation of the variants. =over 3 bool isPUNCT (UV ch) bool isPUNCT_A (UV ch) bool isPUNCT_LC (UV ch) bool isPUNCT_LC_utf8_safe(U8 * s, U8 *end) bool isPUNCT_LC_uvchr (UV ch) bool isPUNCT_L1 (UV ch) bool isPUNCT_utf8 (U8 * s, U8 * end) bool isPUNCT_utf8_safe (U8 * s, U8 * end) bool isPUNCT_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a whitespace character. This is analogous to what C matches in a regular expression. Starting in Perl 5.18 this also matches what C does. Prior to 5.18, only the locale forms of this macro (the ones with C in their names) matched precisely what C does. In those releases, the only difference, in the non-locale variants, was that C did not match a vertical tab. (See L for a macro that matches a vertical tab in all releases.) See the L for an explanation of the variants. =over 3 bool isSPACE (UV ch) bool isSPACE_A (UV ch) bool isSPACE_LC (UV ch) bool isSPACE_LC_utf8_safe(U8 * s, U8 *end) bool isSPACE_LC_uvchr (UV ch) bool isSPACE_L1 (UV ch) bool isSPACE_utf8 (U8 * s, U8 * end) bool isSPACE_utf8_safe (U8 * s, U8 * end) bool isSPACE_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is an uppercase character, analogous to C. See the L for an explanation of the variants. =over 3 bool isUPPER (UV ch) bool isUPPER_A (UV ch) bool isUPPER_LC (UV ch) bool isUPPER_LC_utf8_safe(U8 * s, U8 *end) bool isUPPER_LC_uvchr (UV ch) bool isUPPER_L1 (UV ch) bool isUPPER_utf8 (U8 * s, U8 * end) bool isUPPER_utf8_safe (U8 * s, U8 * end) bool isUPPER_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a character that is a word character, analogous to what C and C match in a regular expression. A word character is an alphabetic character, a decimal digit, a connecting punctuation character (such as an underscore), or a "mark" character that attaches to one of those (like some sort of accent). See the L for an explanation of the variants. C, C, C, C, C, C, and C are also as described there, but additionally include the platform's native underscore. =over 3 bool isWORDCHAR (UV ch) bool isWORDCHAR_A (UV ch) bool isWORDCHAR_LC (UV ch) bool isWORDCHAR_LC_utf8_safe(U8 * s, U8 *end) bool isWORDCHAR_LC_uvchr (UV ch) bool isWORDCHAR_L1 (UV ch) bool isWORDCHAR_utf8 (U8 * s, U8 * end) bool isWORDCHAR_utf8_safe (U8 * s, U8 * end) bool isWORDCHAR_uvchr (UV ch) =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXX Returns a boolean indicating whether the specified character is a hexadecimal digit. In the ASCII range these are C<[0-9A-Fa-f]>. Variants C and C are identical to C. See the L for an explanation of the variants. =over 3 bool isXDIGIT (UV ch) bool isXDIGIT_A (UV ch) bool isXDIGIT_LC (UV ch) bool isXDIGIT_LC_utf8_safe(U8 * s, U8 *end) bool isXDIGIT_LC_uvchr (UV ch) bool isXDIGIT_L1 (UV ch) bool isXDIGIT_utf8 (U8 * s, U8 * end) bool isXDIGIT_utf8_safe (U8 * s, U8 * end) bool isXDIGIT_uvchr (UV ch) =back =back =for hackers Found in file handy.h =head1 Compiler and Preprocessor information =over 4 =item C X This symbol is intended to be used along with C in the same manner symbol C is used with C. It contains either "-" or "". =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the second part of the string which will invoke the C preprocessor on the standard input and produce to standard output. This symbol will have the value "-" if C needs a minus to specify standard input, otherwise the value is "". =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the string which will invoke a C preprocessor on the standard input and produce to standard output. It needs to end with C, after all other preprocessor flags have been specified. The main difference with C is that this program will never be a pointer to a shell wrapper, i.e. it will be empty if no preprocessor is available directly to the user. Note that it may well be different from the preprocessor used to compile the C program. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the first part of the string which will invoke the C preprocessor on the standard input and produce to standard output. Typical value of "cc -E" or "F", but it can also call a wrapper. See C>. =back =for hackers Found in file config.h =over 4 =item C X Can we handle C attribute for functions that should always be inlined. =back =for hackers Found in file config.h =over 4 =item C X Can we handle C attribute for marking deprecated C =back =for hackers Found in file config.h =over 4 =item C X Can we handle C attribute for checking printf-style formats =back =for hackers Found in file config.h =over 4 =item C X Can we handle C attribute for nonnull function parms. =back =for hackers Found in file config.h =over 4 =item C X Can we handle C attribute for functions that do not return =back =for hackers Found in file config.h =over 4 =item C X Can we handle C attribute for pure functions =back =for hackers Found in file config.h =over 4 =item C X Can we handle C attribute for unused variables and arguments =back =for hackers Found in file config.h =over 4 =item C X Can we handle C attribute for functions that should have a different visibility. =back =for hackers Found in file config.h =over 4 =item C X Can we handle C attribute for warning on unused results =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the compiler supports C<__builtin_add_overflow> for adding integers with overflow checks. =back =for hackers Found in file config.h =over 4 =item C X Can we handle C builtin for compile-time ternary-like expressions =back =for hackers Found in file config.h =over 4 =item C X Can we handle C builtin for telling that certain values are more likely =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the compiler supports C<__builtin_mul_overflow> for multiplying integers with overflow checks. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the compiler supports C<__builtin_sub_overflow> for subtracting integers with overflow checks. =back =for hackers Found in file config.h =over 4 =item C X If defined, the compiler supports C99 variadic macros. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C compiler supports C99-style static inline. That is, the function can't be called from another translation unit. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the number of bytes required to align a double, or a long double when applicable. Usual values are 2, 4 and 8. The default is eight, for safety. For cross-compiling or multiarch support, Configure will set a minimum of 8. =back =for hackers Found in file config.h =over 4 =item C X This symbol gives the best-guess incantation to use for static inline functions. If C is defined, this will give C99-style inline. If C is not defined, this will give a plain 'static'. It will always be defined to something that gives static linkage. Possibilities include static inline (c99) static __inline__ (gcc -ansi) static __inline (MSVC) static _inline (older MSVC) static (c89 compilers) =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, gives a linkage specification for thread-local storage. For example, for a C11 compiler this will be C<_Thread_local>. Beware, some compilers are sensitive to the C language standard they are told to parse. For example, suncc defaults to C11, so our probe will report that C<_Thread_local> can be used. However, if the -std=c99 is later added to the compiler flags, then C<_Thread_local> will become a syntax error. Hence it is important for these flags to be consistent between probing and use. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that you must access character data through U32-aligned pointers. =back =for hackers Found in file config.h =head1 Compiler directives =over 4 =item C<__ASSERT_> X<__ASSERT_> This is a helper macro to avoid preprocessor issues, replaced by nothing unless under DEBUGGING, where it expands to an assert of its argument, followed by a comma (hence the comma operator). If we just used a straight assert(), we would get a comma with nothing before it when not DEBUGGING. =over 3 __ASSERT_(bool expr) =back =back =for hackers Found in file handy.h =over 4 =item C X C is like C, but it has a benefit in a release build. It is a hint to a compiler about a statement of fact in a function call free expression, which allows the compiler to generate better machine code. In a debug build, C is a synonym for C. C means the control path is unreachable. In a for loop, C can be used to hint that a loop will run at least X times. C is based off MSVC's C<__assume> intrinsic function, see its documents for more details. =over 3 ASSUME(bool expr) =back =back =for hackers Found in file perl.h =over 4 =item C X Declare nothing; typically used as a placeholder to replace something that used to declare something. Works on compilers that require declarations before any code. =over 3 dNOOP; =back =back =for hackers Found in file perl.h =over 4 =item C X When not compiling using C++, expands to nothing. Otherwise ends a section of code already begun by a C>. =over 3 END_EXTERN_C =back =back =for hackers Found in file perl.h =over 4 =item C X When not compiling using C++, expands to nothing. Otherwise is used in a declaration of a function to indicate the function should have external C linkage. This is required for things to work for just about all functions with external linkage compiled into perl. Often, you can use C> ... C> blocks surrounding all your code that you need to have this linkage. Example usage: EXTERN_C int flock(int fd, int op); =back =for hackers Found in file perl.h =over 4 =item C X Returns the input unchanged, but at the same time it gives a branch prediction hint to the compiler that this condition is likely to be true. =over 3 LIKELY(bool expr) =back =back =for hackers Found in file perl.h =over 4 =item C X Do nothing; typically used as a placeholder to replace something that used to do something. =over 3 NOOP; =back =back =for hackers Found in file perl.h =over 4 =item C X This is used to suppress compiler warnings that a parameter to a function is not used. This situation can arise, for example, when a parameter is needed under some configuration conditions, but not others, so that C preprocessor conditional compilation causes it be used just sometimes. =over 3 PERL_UNUSED_ARG(void x); =back =back =for hackers Found in file perl.h =over 4 =item C X This is used to suppress compiler warnings that the thread context parameter to a function is not used. This situation can arise, for example, when a C preprocessor conditional compilation causes it be used just some times. =over 3 PERL_UNUSED_CONTEXT; =back =back =for hackers Found in file perl.h =over 4 =item C X Tells the compiler that the parameter in the function prototype just before it is not necessarily expected to be used in the function. Not that many compilers understand this, so this should only be used in cases where C> can't conveniently be used. Example usage: =over Signal_t Perl_perly_sighandler(int sig, Siginfo_t *sip PERL_UNUSED_DECL, void *uap PERL_UNUSED_DECL, bool safe) =back =back =for hackers Found in file perl.h =over 4 =item C X This macro indicates to discard the return value of the function call inside it, I, PERL_UNUSED_RESULT(foo(a, b)) The main reason for this is that the combination of C (part of C<-Wall>) and the C<__attribute__((warn_unused_result))> cannot be silenced with casting to C. This causes trouble when the system header files use the attribute. Use C sparingly, though, since usually the warning is there for a good reason: you might lose success/failure information, or leak resources, or changes in resources. But sometimes you just want to ignore the return value, I, on codepaths soon ending up in abort, or in "best effort" attempts, or in situations where there is no good way to handle failures. Sometimes C might not be the most natural way: another possibility is that you can capture the return value and use C> on that. =over 3 PERL_UNUSED_RESULT(void x) =back =back =for hackers Found in file perl.h =over 4 =item C X This is used to suppress compiler warnings that the variable I is not used. This situation can arise, for example, when a C preprocessor conditional compilation causes it be used just some times. =over 3 PERL_UNUSED_VAR(void x); =back =back =for hackers Found in file perl.h =over 4 =item C X When not compiling using C++, expands to nothing. Otherwise begins a section of code in which every function will effectively have C> applied to it, that is to have external C linkage. The section is ended by a C>. =over 3 START_EXTERN_C =back =back =for hackers Found in file perl.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C =item C XX These allow a series of statements in a macro to be used as a single statement, as in if (x) STMT_START { ... } STMT_END else ... Note that you can't return a value out of this construct and cannot use it as an operand to the comma operator. These limit its utility. But, a value could be returned by constructing the API so that a pointer is passed and the macro dereferences this to set the return. If the value can be any of various types, depending on context, you can handle that situation in some situations by adding the type of the return as an extra accompanying parameter: #define foo(param, type) STMT_START { type * param; *param = do_calc; ... } STMT_END This could be awkward, so consider instead using a C language C function. If you do use this construct, it is easy to forget that it is a macro and not a function, and hence fall into traps that might not show up until someone someday writes code which contains names that clash with the ones you chose here, or calls it with a parameter which is an expression with side effects, the consequences of which you didn't think about. See L for how to avoid these. =back =for hackers Found in file perl.h =over 4 =item C X Returns the input unchanged, but at the same time it gives a branch prediction hint to the compiler that this condition is likely to be false. =over 3 UNLIKELY(bool expr) =back =back =for hackers Found in file perl.h =head1 Compile-time scope hooks =over 4 =item C X NOTE: C is B and may change or be removed without notice. Temporarily disable an entry in this BHK structure, by clearing the appropriate flag. C is a preprocessor token indicating which entry to disable. =over 3 void BhkDISABLE(BHK *hk, token which) =back =back =for hackers Found in file op.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Re-enable an entry in this BHK structure, by setting the appropriate flag. C is a preprocessor token indicating which entry to enable. This will assert (under -DDEBUGGING) if the entry doesn't contain a valid pointer. =over 3 void BhkENABLE(BHK *hk, token which) =back =back =for hackers Found in file op.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Set an entry in the BHK structure, and set the flags to indicate it is valid. C is a preprocessing token indicating which entry to set. The type of C depends on the entry. =over 3 void BhkENTRY_set(BHK *hk, token which, void *ptr) =back =back =for hackers Found in file op.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Register a set of hooks to be called when the Perl lexical scope changes at compile time. See L. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_blockhook_register(pTHX_ BHK *hk) =back =back =for hackers Found in file op.c =head1 Concurrency =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Now a no-op. =over 3 void CPERLscope(void x) =back =back =for hackers Found in file perl.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X On threaded perls, set C to C; on unthreaded perls, do nothing =back =for hackers Found in file perl.h =over 4 =item C X Now a synonym for C>. =back =for hackers Found in file perl.h =over 4 =item C X This is now a synonym for dNOOP: declare nothing =back =for hackers Found in file perl.h =over 4 =item C X This symbol, if defined, indicates that the getenv system call doesn't zap the static buffer of C in a different thread. The typical C implementation will return a pointer to the proper position in **environ. But some may instead copy them to a static buffer in C. If there is a per-thread instance of that buffer, or the return points to **environ, then a many-reader/1-writer mutex will work; otherwise an exclusive locking mutex is required to prevent races. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to setup fork handlers. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C system call is available to set the contention scope attribute of a thread attribute object. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to yield the execution of the current thread. C is preferable to C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to yield the execution of the current thread. C is preferable to C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F. =over 3 #ifdef I_MACH_CTHREADS #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F. =over 3 #ifdef I_PTHREAD #include #endif =back =back =for hackers Found in file config.h =over 4 =item C This symbol, if defined, indicates that Perl should be built to use multiplicity. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X This symbol, if defined, indicates how to create pthread in joinable (aka undetached) state. C: not defined if F already has defined C (the new version of the constant). If defined, known values are C and C<__UNDETACHED>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl should be built to use the old draft C threads C. =back =for hackers Found in file config.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X This symbol defines the way to yield the execution of the current thread. Known ways are C, C, and C with C. =back =for hackers Found in file config.h =head1 COPs and Hint Hashes X =over 4 =item C X NOTE: C is B and may change or be removed without notice. Returns the label attached to a cop, and stores its length in bytes into C<*len>. Upon return, C<*flags> will be set to either C or 0. Alternatively, use the macro C>; or if you don't need to know if the label is UTF-8 or not, the macro C>; or if you additionally don't need to know the length, C>. =over 3 const char * cop_fetch_label(COP * const cop, STRLEN *len, U32 *flags) =back =back =for hackers Found in file hv.c =over 4 =item C X Returns the name of the file associated with the C C =over 3 const char * CopFILE(const COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the AV associated with the C C, creating it if necessary. =over 3 AV * CopFILEAV(const COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the AV associated with the C C, returning NULL if it doesn't already exist. =over 3 AV * CopFILEAVn(const COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X Efficiently copies the cop file name from one COP to another. Wraps the required logic to do a refcounted copy under threads or not. =over 3 void CopFILE_copy(COP * dst, COP * src) =back =back =for hackers Found in file cop.h =over 4 =item C X Frees the file data in a cop. Under the hood this is a refcounting operation. =over 3 void CopFILE_free(COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the GV associated with the C C =over 3 GV * CopFILEGV(const COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X Available only on unthreaded perls. Makes C the name of the file associated with the C C =over 3 void CopFILEGV_set(COP *c, GV *gv) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the length of the file associated with the C C =over 3 const char * CopFILE_LEN(const COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X Makes C the name of the file associated with the C C =over 3 void CopFILE_set(COP * c, const char * pv) =back =back =for hackers Found in file cop.h =over 4 =item C X Makes C the name of the file associated with the C C =over 3 void CopFILE_setn(COP * c, const char * pv, STRLEN len) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the SV associated with the C C =over 3 SV * CopFILESV(const COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Make and return a complete copy of the cop hints hash C. =over 3 COPHH * cophh_copy(COPHH *cophh) =back =back =for hackers Found in file cop.h =over 4 =item C =item C =item C =item C XXXX NOTE: all these forms are B and may change or be removed without notice. These delete a key and its associated value from the cop hints hash C, and return 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 forms differ in how the key is specified. In all forms, the key is pointed to by C. In the plain C form, the key is a C language NUL-terminated string. In the C form, the key is a C language string literal. In the C form, an additional parameter, C, specifies the length of the string, which hence, may contain embedded-NUL characters. In the C form, C<*key> is an SV, and the key is the PV extracted from that. using C>. C is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the C form, as it is computed automatically at compile time. The only flag currently used from the C parameter is C. It is illegal to set this in the C form. In the C forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The C form uses the underlying SV to determine the UTF-8ness of the octets. =over 3 COPHH * cophh_delete_pv (COPHH *cophh, const char *key, U32 hash, U32 flags) COPHH * cophh_delete_pvn(COPHH *cophh, const char *key, STRLEN keylen, U32 hash, U32 flags) COPHH * cophh_delete_pvs(COPHH *cophh, "key", U32 flags) COPHH * cophh_delete_sv (COPHH *cophh, SV *key, U32 hash, U32 flags) =back =back =for hackers Found in file cop.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. These look up the hint entry in the cop C with the key specified by C (and C in the C form), returning true if a value exists, and false otherwise. The forms differ in how the key is specified. In the plain C form, the key is a C language NUL-terminated string. In the C form, the key is a C language string literal. In the C form, an additional parameter, C, specifies the length of the string, which hence, may contain embedded-NUL characters. In the C form, C<*key> is an SV, and the key is the PV extracted from that. using C>. C is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the C form, as it is computed automatically at compile time. The only flag currently used from the C parameter is C. It is illegal to set this in the C form. In the C forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The C form uses the underlying SV to determine the UTF-8ness of the octets. =over 3 bool cophh_exists_pvn(const COPHH *cophh, const char *key, STRLEN keylen, U32 hash, U32 flags) =back =back =for hackers Found in file cop.h =over 4 =item C =item C =item C =item C XXXX NOTE: all these forms are B and may change or be removed without notice. These look up the entry in the cop hints hash C with the key specified by C (and C in the C form), returning that value as a mortal scalar copy, or C<&PL_sv_placeholder> if there is no value associated with the key. The forms differ in how the key is specified. In the plain C form, the key is a C language NUL-terminated string. In the C form, the key is a C language string literal. In the C form, an additional parameter, C, specifies the length of the string, which hence, may contain embedded-NUL characters. In the C form, C<*key> is an SV, and the key is the PV extracted from that. using C>. C is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the C form, as it is computed automatically at compile time. The only flag currently used from the C parameter is C. It is illegal to set this in the C form. In the C forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The C form uses the underlying SV to determine the UTF-8ness of the octets. =over 3 SV * cophh_fetch_pv (const COPHH *cophh, const char *key, U32 hash, U32 flags) SV * cophh_fetch_pvn(const COPHH *cophh, const char *key, STRLEN keylen, U32 hash, U32 flags) SV * cophh_fetch_pvs(const COPHH *cophh, "key", U32 flags) SV * cophh_fetch_sv (const COPHH *cophh, SV *key, U32 hash, U32 flags) =back =back =for hackers Found in file cop.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Discard the cop hints hash C, freeing all resources associated with it. =over 3 void cophh_free(COPHH *cophh) =back =back =for hackers Found in file cop.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Generates and returns a standard Perl hash representing the full set of key/value pairs in the cop hints hash C. C is currently unused and must be zero. =over 3 HV * cophh_2hv(const COPHH *cophh, U32 flags) =back =back =for hackers Found in file cop.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Generate and return a fresh cop hints hash containing no entries. =over 3 COPHH * cophh_new_empty() =back =back =for hackers Found in file cop.h =over 4 =item C =item C =item C =item C XXXX NOTE: all these forms are B and may change or be removed without notice. These store a value, associated with a key, in the cop hints hash C, and return 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. C is the scalar value to store for this key. C is copied by these functions, which thus do not take ownership of any reference to it, and hence 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. The forms differ in how the key is specified. In all forms, the key is pointed to by C. In the plain C form, the key is a C language NUL-terminated string. In the C form, the key is a C language string literal. In the C form, an additional parameter, C, specifies the length of the string, which hence, may contain embedded-NUL characters. In the C form, C<*key> is an SV, and the key is the PV extracted from that. using C>. C is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the C form, as it is computed automatically at compile time. The only flag currently used from the C parameter is C. It is illegal to set this in the C form. In the C forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The C form uses the underlying SV to determine the UTF-8ness of the octets. =over 3 COPHH * cophh_store_pv (COPHH *cophh, const char *key, U32 hash, SV *value, U32 flags) COPHH * cophh_store_pvn(COPHH *cophh, const char *key, STRLEN keylen, U32 hash, SV *value, U32 flags) COPHH * cophh_store_pvs(COPHH *cophh, "key", SV *value, U32 flags) COPHH * cophh_store_sv (COPHH *cophh, SV *key, U32 hash, SV *value, U32 flags) =back =back =for hackers Found in file cop.h =over 4 =item C =item C =item C =item C XXXX These look up the hint entry in the cop C with the key specified by C (and C in the C form), returning true if a value exists, and false otherwise. The forms differ in how the key is specified. In all forms, the key is pointed to by C. In the plain C form, the key is a C language NUL-terminated string. In the C form, the key is a C language string literal. In the C form, an additional parameter, C, specifies the length of the string, which hence, may contain embedded-NUL characters. In the C form, C<*key> is an SV, and the key is the PV extracted from that. using C>. C is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the C form, as it is computed automatically at compile time. The only flag currently used from the C parameter is C. It is illegal to set this in the C form. In the C forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The C form uses the underlying SV to determine the UTF-8ness of the octets. =over 3 bool cop_hints_exists_pv (const COP *cop, const char *key, U32 hash, U32 flags) bool cop_hints_exists_pvn(const COP *cop, const char *key, STRLEN keylen, U32 hash, U32 flags) bool cop_hints_exists_pvs(const COP *cop, "key", U32 flags) bool cop_hints_exists_sv (const COP *cop, SV *key, U32 hash, U32 flags) =back =back =for hackers Found in file cop.h =over 4 =item C =item C =item C =item C XXXX These look up the hint entry in the cop C with the key specified by C (and C in the C form), returning that value as a mortal scalar copy, or C<&PL_sv_placeholder> if there is no value associated with the key. The forms differ in how the key is specified. In the plain C form, the key is a C language NUL-terminated string. In the C form, the key is a C language string literal. In the C form, an additional parameter, C, specifies the length of the string, which hence, may contain embedded-NUL characters. In the C form, C<*key> is an SV, and the key is the PV extracted from that. using C>. C is a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from the C form, as it is computed automatically at compile time. The only flag currently used from the C parameter is C. It is illegal to set this in the C form. In the C forms, it specifies whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if cleared). The C form uses the underlying SV to determine the UTF-8ness of the octets. =over 3 SV * cop_hints_fetch_pv (const COP *cop, const char *key, U32 hash, U32 flags) SV * cop_hints_fetch_pvn(const COP *cop, const char *key, STRLEN keylen, U32 hash, U32 flags) SV * cop_hints_fetch_pvs(const COP *cop, "key", U32 flags) SV * cop_hints_fetch_sv (const COP *cop, SV *key, U32 hash, U32 flags) =back =back =for hackers Found in file cop.h =over 4 =item C X Generates and returns a standard Perl hash representing the full set of hint entries in the cop C. C is currently unused and must be zero. =over 3 HV * cop_hints_2hv(const COP *cop, U32 flags) =back =back =for hackers Found in file cop.h =over 4 =item C =item C =item C XXX These return the label attached to a cop. C and C additionally store the number of bytes comprising the returned label into C<*len>. C additionally returns the UTF-8ness of the returned label, by setting C<*flags> to 0 or C. =over 3 const char * CopLABEL (COP *const cop) const char * CopLABEL_len (COP *const cop, STRLEN *len) const char * CopLABEL_len_flags(COP *const cop, STRLEN *len, U32 *flags) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the line number in the source code associated with the C C =over 3 line_t CopLINE(const COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the stash associated with C. =over 3 HV * CopSTASH(const COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns a boolean as to whether or not C is the stash associated with C. =over 3 bool CopSTASH_eq(const COP * c, const HV * hv) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the package name of the stash associated with C, or C if no associated stash =over 3 char * CopSTASHPV(const COP * c) =back =back =for hackers Found in file cop.h =over 4 =item C X Set the package name of the stash associated with C, to the NUL-terminated C string C

, creating the package if necessary. =over 3 void CopSTASHPV_set(COP * c, const char * pv) =back =back =for hackers Found in file cop.h =over 4 =item C X Set the stash associated with C to C. =over 3 bool CopSTASH_set(COP * c, HV * hv) =back =back =for hackers Found in file cop.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Save a label into a C. You need to set flags to C for a UTF-8 label. Any other flag is ignored. =over 3 void cop_store_label(COP * const cop, const char *label, STRLEN len, U32 flags) =back =back =for hackers Found in file hv.c =over 4 =item C X Use this typedef to declare variables that are to hold C. =back =for hackers Found in file cop.h =over 4 =item C X The currently active COP (control op) roughly representing the current statement in the source. On threaded perls, each thread has an independent copy of this variable; each initialized at creation time with the current value of the creating thread's copy. =over 3 COP* PL_curcop =back =back =for hackers Found in file intrpvar.h =over 4 =item C X Returns the length of a pv created with C. Note that this reflects the length of the string from the callers point of view, it does not include the mandatory null which is always injected at the end of the string by rcpv_new(). No checks are performed to ensure that C was actually allocated with C, it is the callers responsibility to ensure that this is the case. =over 3 RCPV * RCPV_LEN(char *pv) =back =back =for hackers Found in file cop.h =over 4 =item C X Decrements the refcount for a C pointer which was created with a call to C. Same as calling rcpv_free(). No checks are performed to ensure that C was actually allocated with C, it is the callers responsibility to ensure that this is the case. =over 3 RCPV * RCPV_REFCNT_dec(char *pv) =back =back =for hackers Found in file cop.h =over 4 =item C X Increments the refcount for a C pointer which was created with a call to C. Same as calling rcpv_copy(). No checks are performed to ensure that C was actually allocated with C, it is the callers responsibility to ensure that this is the case. =over 3 RCPV * RCPV_REFCNT_inc(char *pv) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the refcount for a pv created with C. No checks are performed to ensure that C was actually allocated with C, it is the callers responsibility to ensure that this is the case. =over 3 RCPV * RCPV_REFCOUNT(char *pv) =back =back =for hackers Found in file cop.h =over 4 =item C X Returns the RCPV structure (struct rcpv) for a refcounted string pv created with C. No checks are performed to ensure that C was actually allocated with C, it is the callers responsibility to ensure that this is the case. =over 3 RCPV * RCPVx(char *pv) =back =back =for hackers Found in file cop.h =head1 Custom Operators =over 4 =item C X Register a custom op. See L. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_custom_op_register(pTHX_ Perl_ppaddr_t ppaddr, const XOP *xop) =back =back =for hackers Found in file op.c =over 4 =item C X Return the XOP structure for a given custom op. This macro should be considered internal to C and the other access macros: use them instead. This macro does call a function. Prior to 5.19.6, this was implemented as a function. =over 3 const XOP * Perl_custom_op_xop(pTHX_ const OP *o) =back =back =for hackers Found in file op.c =over 4 =item C X Temporarily disable a member of the XOP, by clearing the appropriate flag. =over 3 void XopDISABLE(XOP *xop, token which) =back =back =for hackers Found in file op.h =over 4 =item C X Reenable a member of the XOP which has been disabled. =over 3 void XopENABLE(XOP *xop, token which) =back =back =for hackers Found in file op.h =over 4 =item C X Return a member of the XOP structure. C 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 C. This macro evaluates its arguments more than once. If you are using C to retrieve a C from a C, use the more efficient L instead. =over 3 XopENTRY(XOP *xop, token which) =back =back =for hackers Found in file op.h =over 4 =item C X Exactly like C but more efficient. The C parameter is identical to L. =over 3 XopENTRYCUSTOM(const OP *o, token which) =back =back =for hackers Found in file op.h =over 4 =item C X Set a member of the XOP structure. C is a cpp token indicating which entry to set. See L for details about the available members and how they are used. This macro evaluates its argument more than once. =over 3 void XopENTRY_set(XOP *xop, token which, value) =back =back =for hackers Found in file op.h =over 4 =item C X Return the XOP's flags. =over 3 U32 XopFLAGS(XOP *xop) =back =back =for hackers Found in file op.h =head1 CV Handling XX This section documents functions to manipulate CVs which are code-values, meaning subroutines. For more information, see L. =over 4 =item C 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. =over 3 const PERL_CONTEXT * caller_cx(I32 level, const PERL_CONTEXT **dbcxp) =back =back =for hackers Found in file pp_ctl.c =over 4 =item C X Returns the recursion level of the CV C. Hence >= 2 indicates we are in a recursive call. =over 3 I32 * CvDEPTH(const CV * const sv) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns the GV associated with the CV C, reifying it if necessary. =over 3 GV * CvGV(CV *sv) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns the stash of the CV. A stash is the symbol table hash, containing the package-scoped variables in the package where the subroutine was defined. For more information, see L. This also has a special use with XS AUTOLOAD subs. See L. =over 3 HV* CvSTASH(CV* cv) =back =back =for hackers Found in file cv.h =over 4 =item C X Locate the CV corresponding to the currently executing sub or eval. If C is non_null, skip CVs that are in the DB package and populate C<*db_seqp> with the cop sequence number at the point that the DB:: code was entered. (This allows debuggers to eval in the scope of the breakpoint rather than in the scope of the debugger itself.) =over 3 CV * find_runcv(U32 *db_seqp) =back =back =for hackers Found in file pp_ctl.c =over 4 =item C =item C =item C XXX These return 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. The forms differ only in how the subroutine is specified.. With C, the name is a literal C string, enclosed in double quotes. With C, the name is given by the C parameter, which must be a NUL-terminated C string. With C, the name is also given by the C parameter, but it is a Perl string (possibly containing embedded NUL bytes), and its length in bytes is contained in the C parameter. NOTE: the C form is B. NOTE: the C form is B. NOTE: the C form is B. =over 3 CV * get_cv (const char *name, I32 flags) CV * get_cvn_flags(const char *name, STRLEN len, I32 flags) CV * get_cvs ("string", I32 flags) =back =back =for hackers Found in file perl.c =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Null CV pointer. (deprecated - use C<(CV *)NULL> instead) =back =for hackers Found in file cv.h =head1 Debugging =over 4 =item C X Dumps the contents of an AV to the C filehandle, Similar to using Devel::Peek on an arrayref but does not expect an RV wrapper. Dumps contents to a depth of 3 levels deep. =over 3 void av_dump(AV *av) =back =back =for hackers Found in file dump.c =over 4 =item C =item C XX When perl is compiled with C<-DDEBUGGING>, this prints to STDERR the information given by the arguments, prefaced by the name of the file containing the script causing the call, and the line number within that file. If the C (verbose) debugging option is in effect, the process id is also printed. The two forms differ only in that C does not take a thread context (C) parameter, so is used in situations where the caller doesn't already have the thread context. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_deb (pTHX_ const char *pat, ...) void deb_nocontext(const char *pat, ...) =back =back =for hackers Found in file deb.c =over 4 =item C X Dump the current stack =over 3 I32 debstack() =back =back =for hackers Found in file deb.c =over 4 =item C X Dumps the entire optree of the current program starting at C to C. Also dumps the optrees for all visible subroutines in C. =over 3 void dump_all() =back =back =for hackers Found in file dump.c =over 4 =item C X Dumps the C backtrace to the given C. Returns true if a backtrace could be retrieved, false if not. =over 3 bool dump_c_backtrace(PerlIO *fp, int max_depth, int skip) =back =back =for hackers Found in file util.c =over 4 =item C Described in L. =over 3 void dump_eval() =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Dumps the contents of the format contained in the GV C to C, or a message that one doesn't exist. =over 3 void dump_form(const GV *gv) =back =back =for hackers Found in file dump.c =over 4 =item C X Dumps the optrees for all visible subroutines in C. =over 3 void dump_packsubs(const HV *stash) =back =back =for hackers Found in file dump.c =over 4 =item C Described in L. =over 3 void dump_sub(const GV *gv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Returns a SV containing a dump of C frames of the call stack, skipping the C innermost ones. C of 20 is usually enough. The appended output looks like: ... 1 10e004812:0082 Perl_croak util.c:1716 /usr/bin/perl 2 10df8d6d2:1d72 perl_parse perl.c:3975 /usr/bin/perl ... The fields are tab-separated. The first column is the depth (zero being the innermost non-skipped frame). In the hex:offset, the hex is where the program counter was in C, and the :offset (might be missing) tells how much inside the C the program counter was. The C is the source code file and line number. The F is obvious (hopefully). Unknowns are C<"-">. Unknowns can happen unfortunately quite easily: if the platform doesn't support retrieving the information; if the binary is missing the debug information; if the optimizer has transformed the code by for example inlining. =over 3 SV * get_c_backtrace_dump(int max_depth, int skip) =back =back =for hackers Found in file util.c =over 4 =item C X Dump the name and, if they differ, the effective name of the GV C to C. =over 3 void gv_dump(GV *gv) =back =back =for hackers Found in file dump.c =over 4 =item C X This symbol, if defined, indicates that the C routine is available to get a stack trace. The F header must be included to use this routine. =back =for hackers Found in file config.h =over 4 =item C X Dumps the contents of an HV to the C filehandle. Similar to using Devel::Peek on an hashref but does not expect an RV wrapper. Dumps contents to a depth of 3 levels deep. =over 3 void hv_dump(HV *hv) =back =back =for hackers Found in file dump.c =over 4 =item C X Dumps the contents of the MAGIC C to C. =over 3 void magic_dump(const MAGIC *mg) =back =back =for hackers Found in file dump.c =over 4 =item C X Given an op, determine what type of struct it has been allocated as. Returns one of the OPclass enums, such as OPclass_LISTOP. =over 3 OPclass op_class(const OP *o) =back =back =for hackers Found in file dump.c =over 4 =item C X Dumps the optree starting at OP C to C. =over 3 void op_dump(const OP *o) =back =back =for hackers Found in file dump.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlhacktips.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlhacktips.pod =over 4 =item C X Dump an OP that is related to Pattern Matching, such as C; these require special handling. =over 3 void pmop_dump(PMOP *pm) =back =back =for hackers Found in file dump.c =over 4 =item C X Dumps the contents of an SV to the C filehandle. For an example of its output, see L. If the item is an SvROK it will dump items to a depth of 4, otherwise it will dump only the top level item, which means that it will not dump the contents of an AV * or HV *. For that use C or C. =over 3 void sv_dump(SV *sv) =back =back =for hackers Found in file dump.c =over 4 =item C X Dumps the contents of an SV to the C filehandle to the depth requested. This function can be used on any SV derived type (GV, HV, AV) with an appropriate cast. This is a more flexible variant of sv_dump(). For example HV *hv = ...; sv_dump_depth((SV*)hv, 2); would dump the hv, its keys and values, but would not recurse into any RV values. =over 3 void sv_dump_depth(SV *sv, I32 depth) =back =back =for hackers Found in file dump.c =over 4 =item C X This is like C>, but C are an encapsulated argument list. =over 3 void vdeb(const char *pat, va_list *args) =back =back =for hackers Found in file deb.c =head1 Display functions XXXXXXXXXXXXX =over 4 =item C

=item C XX These take a sprintf-style format pattern and conventional (non-SV) arguments and return 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); They use a single (per-thread) 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). The two forms differ only in that C does not take a thread context (C) parameter, so is used in situations where the caller doesn't already have the thread context. NOTE: C must be explicitly called as C with an C parameter. =over 3 char * Perl_form (pTHX_ const char *pat, ...) char * form_nocontext(const char *pat, ...) =back =back =for hackers Found in file util.c =over 4 =item C =item C XX These take a sprintf-style format pattern and argument list, which 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 C>. Normally, the resulting message is returned in a new mortal SV. But during global destruction a single SV may be shared between uses of this function. The two forms differ only in that C does not take a thread context (C) parameter, so is used in situations where the caller doesn't already have the thread context. NOTE: C must be explicitly called as C with an C parameter. =over 3 SV * Perl_mess (pTHX_ const char *pat, ...) SV * mess_nocontext(const char *pat, ...) =back =back =for hackers Found in file util.c =over 4 =item C 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. =over 3 SV * mess_sv(SV *basemsg, bool consume) =back =back =for hackers Found in file util.c =over 4 =item C 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. =over 3 char * pv_display(SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim) =back =back =for hackers Found in file dump.c =over 4 =item C X Escapes at most the first C chars of C and puts the results into C such that the size of the escaped string will not exceed C chars and will not contain any incomplete escape sequences. The number of bytes escaped will be returned in the C parameter if it is not null. When the C parameter is null no escaping actually occurs, but the number of bytes that would be escaped were it not null will be calculated. If flags contains C 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 C is set this will not occur. If C is set then the input string is treated as UTF-8. If C is set then the input string is scanned using C to determine if it is UTF-8. If C is set then all input chars will be output using C<\x01F1> style escapes, otherwise if C is set, only non-ASCII chars 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 C then all chars below 255 will be treated as printable and will be output as literals. The C modifies the previous rules to cause word chars, unicode or otherwise, to be output as literals, note this uses the *unicode* rules for deciding on word characters. If C 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 C is set then the escape char used will be a C<"%"> and not a C<"\\">. This is because regexes very often contain backslashed sequences, whereas C<"%"> is not a particularly common character in patterns. Returns a pointer to the escaped text as held by C. =over 3 char * pv_escape(SV *dsv, char const * const str, const STRLEN count, STRLEN max, STRLEN * const escaped, U32 flags) =back =back =for hackers Found in file dump.c =over 4 =item C X Converts a string into something presentable, handling escaping via C and supporting quoting and ellipses. If the C flag is set then the result will be double quoted with any double quotes in the string escaped. Otherwise if the C flag is set then the result be wrapped in angle brackets. If the C 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 C is non-null then it will be inserted after the opening quote (if there is one) but before the escaped text. If C 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 C. =over 3 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) =back =back =for hackers Found in file dump.c =over 4 =item C X Like C> but but the arguments are an encapsulated argument list. =over 3 char * vform(const char *pat, va_list *args) =back =back =for hackers Found in file util.c =over 4 =item C X C and C are a sprintf-style format pattern and encapsulated argument list, respectively. 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. =over 3 SV * vmess(const char *pat, va_list *args) =back =back =for hackers Found in file util.c =head1 Embedding, Threads, and Interpreter Cloning XXXXXXXXX =over 4 =item C X Add a function C to the list of functions to be called at global destruction. C will be passed as an argument to C; it can point to a C so that you can pass anything you want. Note that under threads, C may run multiple times. This is because the list is executed each time the current or any descendent thread terminates. =over 3 void call_atexit(ATEXIT_t fn, void *ptr) =back =back =for hackers Found in file perl.c =over 4 =item C X Clone a CV, making a lexical closure. C supplies the prototype of the function: its code, pad structure, and other attributes. The prototype is combined with a capture of outer lexicals to which the code refers, which are taken from the currently-executing instance of the immediately surrounding code. =over 3 CV * cv_clone(CV *proto) =back =back =for hackers Found in file pad.c =over 4 =item C X Returns an SV containing the name of the CV, mainly for use in error reporting. The CV may actually be a GV instead, in which case the returned SV holds the GV's name. Anything other than a GV or CV is treated as a string already holding the sub name, but this could change in the future. An SV may be passed as a second argument. If so, the name will be assigned to it and it will be returned. Otherwise the returned SV will be a new mortal. If C has the C bit set, then the package name will not be included. If the first argument is neither a CV nor a GV, this flag is ignored (subject to change). =over 3 SV * cv_name(CV *cv, SV *sv, U32 flags) =back =back =for hackers Found in file pad.c =over 4 =item C 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 C pointer, so that any anonymous children can still follow the full lexical scope chain. =over 3 void cv_undef(CV *cv) =back =back =for hackers Found in file pad.c =over 4 =item C X Returns the global variable C<$_>. =over 3 SV * find_rundefsv() =back =back =for hackers Found in file pad.c =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Return a pointer to the array of all the descriptions of the various OPs Given an opcode from the enum in F, C returns a pointer to a C language string giving its description. =over 3 char ** get_op_descs() =back =back =for hackers Found in file util.c =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Return a pointer to the array of all the names of the various OPs Given an opcode from the enum in F, C returns a pointer to a C language string giving its name. =over 3 char ** get_op_names() =back =back =for hackers Found in file util.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlembed.pod =over 4 =item C X "Introduce" C variables to visible status. This is called during parsing at the end of each statement to make lexical variables visible to subsequent statements. =over 3 U32 intro_my() =back =back =for hackers Found in file pad.c =over 4 =item C =item C XX These load the module whose name is pointed to by the string part of C. Note that the actual module name, not its filename, should be given. Eg, "Foo::Bar" instead of "Foo/Bar.pm". ver, if specified and not NULL, provides version semantics similar to C. The optional trailing arguments can be used to specify arguments to the module's C method, similar to C; their precise handling depends on the flags. The flags argument is a bitwise-ORed collection of any of C, C, or C (or 0 for no flags). If C is set, the module is loaded as if with an empty import list, as in C; this is the only circumstance in which the trailing optional arguments may be omitted entirely. Otherwise, if C is set, the trailing arguments must consist of exactly one C, containing the op tree that produces the relevant import arguments. Otherwise, the trailing arguments must all be C values that will be used as import arguments; and the list must be terminated with C<(SV*) NULL>. If neither C nor C is set, the trailing C pointer is needed even if no import arguments are desired. The reference count for each specified C argument is decremented. In addition, the C argument is modified. If C is set, the module is loaded as if with C rather than C. C and C have the same apparent signature, but the former hides the fact that it is accessing a thread context parameter. So use the latter when you get a compilation error about C. =over 3 void load_module (U32 flags, SV *name, SV *ver, ...) void load_module_nocontext(U32 flags, SV *name, SV *ver, ...) =back =back =for hackers Found in file op.c =over 4 =item C X A wrapper for the C library L, honoring what L say to do. =over 3 void my_exit(U32 status) =back =back =for hackers Found in file perl.c =over 4 =item C X Exit the running Perl process with an error. On non-VMS platforms, this is essentially equivalent to L>, using C, but forces an en error code of 255 if C is 0. On VMS, it takes care to set the appropriate severity bits in the exit status. =over 3 void my_failure_exit() =back =back =for hackers Found in file perl.c =over 4 =item C X The C library C if available, or a Perl implementation of it. This operates on C C-terminated strings. C appends string C to the end of C. It will append at most S> characters. It will then C-terminate, unless C is 0 or the original C string was longer than C (in practice this should not happen as it means that either C is incorrect or that C is not a proper C-terminated string). Note that C is the full size of the destination buffer and the result is guaranteed to be C-terminated if there is room. Note that room for the C should be included in C. The return value is the total length that C would have if C is sufficiently large. Thus it is the initial length of C plus the length of C. If C is smaller than the return, the excess was not appended. =over 3 Size_t my_strlcat(char *dst, const char *src, Size_t size) =back =back =for hackers Found in file inline.h =over 4 =item C X The C library C if available, or a Perl implementation of it. This operates on C C-terminated strings. C copies up to S> characters from the string C to C, C-terminating the result if C is not 0. The return value is the total length C would be if the copy completely succeeded. If it is larger than C, the excess was not copied. =over 3 Size_t my_strlcpy(char *dst, const char *src, Size_t size) =back =back =for hackers Found in file inline.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Creates a new pad name list. C is the highest index for which space is allocated. =over 3 PADNAMELIST * newPADNAMELIST(size_t max) =back =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Constructs and returns a new pad name. Only use this function for names that refer to outer lexicals. (See also L.) C is the outer pad name that this one mirrors. The returned pad name has the C flag already set. =over 3 PADNAME * newPADNAMEouter(PADNAME *outer) =back =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Constructs and returns a new pad name. C must be a UTF-8 string. Do not use this for pad names that point to outer lexicals. See C>. =over 3 PADNAME * newPADNAMEpvn(const char *s, STRLEN len) =back =back =for hackers Found in file pad.c =over 4 =item C X Stub that provides thread hook for perl_destruct when there are no threads. =over 3 int nothreadhook() =back =back =for hackers Found in file perl.c =over 4 =item C X Allocates a place in the currently-compiling pad (via L) for an anonymous function that is lexically scoped inside the currently-compiling function. The function C is linked into the pad, and its C link to the outer scope is weakened to avoid a reference loop. One reference count is stolen, so you may need to do C. C should be an opcode indicating the type of operation that the pad entry is to support. This doesn't affect operational semantics, but is used for debugging. =over 3 PADOFFSET pad_add_anon(CV *func, I32 optype) =back =back =for hackers Found in file pad.c =over 4 =item C X Exactly like L, but takes a nul-terminated string instead of a string/length pair. =over 3 PADOFFSET pad_add_name_pv(const char *name, const U32 flags, HV *typestash, HV *ourstash) =back =back =for hackers Found in file pad.c =over 4 =item C X Allocates a place in the currently-compiling pad for a named lexical variable. Stores the name and other metadata in the name part of the pad, and makes preparations to manage the variable's lexical scoping. Returns the offset of the allocated pad slot. C/C specify the variable's name, including leading sigil. If C is non-null, the name is for a typed lexical, and this identifies the type. If C is non-null, it's a lexical reference to a package variable, and this identifies the package. The following flags can be OR'ed together: padadd_OUR redundantly specifies if it's a package var padadd_STATE variable will retain value persistently padadd_NO_DUP_CHECK skip check for lexical shadowing padadd_FIELD specifies that the lexical is a field for a class =over 3 PADOFFSET pad_add_name_pvn(const char *namepv, STRLEN namelen, U32 flags, HV *typestash, HV *ourstash) =back =back =for hackers Found in file pad.c =over 4 =item C X Exactly like L, but takes the name string in the form of an SV instead of a string/length pair. =over 3 PADOFFSET pad_add_name_sv(SV *name, U32 flags, HV *typestash, HV *ourstash) =back =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Allocates a place in the currently-compiling pad, returning the offset of the allocated pad slot. No name is initially attached to the pad slot. C is a set of flags indicating the kind of pad entry required, which will be set in the value SV for the allocated pad entry: SVs_PADMY named lexical variable ("my", "our", "state") SVs_PADTMP unnamed temporary store SVf_READONLY constant shared between recursion levels C has been supported here only since perl 5.20. To work with earlier versions as well, use C. C does not cause the SV in the pad slot to be marked read-only, but simply tells C that it I be made read-only (by the caller), or at least should be treated as such. C should be an opcode indicating the type of operation that the pad entry is to support. This doesn't affect operational semantics, but is used for debugging. =over 3 PADOFFSET pad_alloc(I32 optype, U32 tmptype) =back =back =for hackers Found in file pad.c =over 4 =item C X Exactly like L, but takes a nul-terminated string instead of a string/length pair. =over 3 PADOFFSET pad_findmy_pv(const char *name, U32 flags) =back =back =for hackers Found in file pad.c =over 4 =item C X Given the name of a lexical variable, find its position in the currently-compiling pad. C/C specify the variable's name, including leading sigil. C is reserved and must be zero. If it is not in the current pad but appears in the pad of any lexically enclosing scope, then a pseudo-entry for it is added in the current pad. Returns the offset in the current pad, or C if no such lexical is in scope. =over 3 PADOFFSET pad_findmy_pvn(const char *namepv, STRLEN namelen, U32 flags) =back =back =for hackers Found in file pad.c =over 4 =item C X Exactly like L, but takes the name string in the form of an SV instead of a string/length pair. =over 3 PADOFFSET pad_findmy_sv(SV *name, U32 flags) =back =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Fetches the pad name from the given index. =over 3 PADNAME * padnamelist_fetch(PADNAMELIST *pnl, SSize_t key) =back =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Stores the pad name (which may be null) at the given index, freeing any existing pad name in that slot. =over 3 PADNAME ** padnamelist_store(PADNAMELIST *pnl, SSize_t key, PADNAME *val) =back =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Tidy up a pad at the end of compilation of the code to which it belongs. Jobs performed here are: remove most stuff from the pads of anonsub prototypes; give it a C<@_>; mark temporaries as such. C indicates the kind of subroutine: padtidy_SUB ordinary subroutine padtidy_SUBCLONE prototype for lexical closure padtidy_FORMAT format =over 3 void pad_tidy(padtidy_type type) =back =back =for hackers Found in file pad.c =over 4 =item C X Allocates a new Perl interpreter. See L. =over 3 PerlInterpreter * perl_alloc() =back =back =for hackers Found in file perl.c =over 4 =item C Described in L. =over 3 void PERL_ASYNC_CHECK() =back =back =for hackers Found in file pod/perlinterp.pod =over 4 =item C X Create and return a new interpreter by cloning the current one. C takes these flags as parameters: C - 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 C while the threads->create doesn't. C - C 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 C is not set then C will kill the ptr_table using the function S>. A reason to keep it around is if you want to dup some of your own variables which are outside the graph that perl scans. C - This is a win32 thing, it is ignored on unix, it tells perl's 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. =over 3 PerlInterpreter * perl_clone(PerlInterpreter *proto_perl, UV flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Initializes a new Perl interpreter. See L. =over 3 void perl_construct(PerlInterpreter *my_perl) =back =back =for hackers Found in file perl.c =over 4 =item C X Shuts down a Perl interpreter. See L for a tutorial. C points to the Perl interpreter. It must have been previously created through the use of L and L. It may have been initialised through L, and may have been used through L and other means. This function should be called for any Perl interpreter that has been constructed with L, even if subsequent operations on it failed, for example if L returned a non-zero value. If the interpreter's C word has the C flag set, then this function will execute code in C blocks before performing the rest of destruction. If it is desired to make any use of the interpreter between L and L other than just calling L, then this flag should be set early on. This matters if L will not be called, or if anything else will be done in addition to calling L. Returns a value be a suitable value to pass to the C library function C (or to return from C
), to serve as an exit code indicating the nature of the way the interpreter terminated. This takes into account any failure of L and any early exit from L. The exit code is of the type required by the host operating system, so because of differing exit code conventions it is not portable to interpret specific numeric values as having specific meanings. =over 3 int perl_destruct(PerlInterpreter *my_perl) =back =back =for hackers Found in file perl.c =over 4 =item C X Releases a Perl interpreter. See L. =over 3 void perl_free(PerlInterpreter *my_perl) =back =back =for hackers Found in file perl.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlembed.pod =over 4 =item C X Tells a Perl interpreter to parse a Perl script. This performs most of the initialisation of a Perl interpreter. See L for a tutorial. C points to the Perl interpreter that is to parse the script. It must have been previously created through the use of L and L. C points to a callback function that will be called to set up the ability for this Perl interpreter to load XS extensions, or may be null to perform no such setup. C and C supply a set of command-line arguments to the Perl interpreter, as would normally be passed to the C
function of a C program. C must be null. These arguments are where the script to parse is specified, either by naming a script file or by providing a script in a C<-e> option. If L|perlvar/$0> will be written to in the Perl interpreter, then the argument strings must be in writable memory, and so mustn't just be string constants. C specifies a set of environment variables that will be used by this Perl interpreter. If non-null, it must point to a null-terminated array of environment strings. If null, the Perl interpreter will use the environment supplied by the C global variable. This function initialises the interpreter, and parses and compiles the script specified by the command-line arguments. This includes executing code in C, C, and C blocks. It does not execute C blocks or the main program. Returns an integer of slightly tricky interpretation. The correct use of the return value is as a truth value indicating whether there was a failure in initialisation. If zero is returned, this indicates that initialisation was successful, and it is safe to proceed to call L and make other use of it. If a non-zero value is returned, this indicates some problem that means the interpreter wants to terminate. The interpreter should not be just abandoned upon such failure; the caller should proceed to shut the interpreter down cleanly with L and free it with L. For historical reasons, the non-zero return value also attempts to be a suitable value to pass to the C library function C (or to return from C
), to serve as an exit code indicating the nature of the way initialisation terminated. However, this isn't portable, due to differing exit code conventions. An attempt is made to return an exit code of the type required by the host operating system, but because it is constrained to be non-zero, it is not necessarily possible to indicate every type of exit. It is only reliable on Unix, where a zero exit code can be augmented with a set bit that will be ignored. In any case, this function is not the correct place to acquire an exit code: one should get that from L. =over 3 int perl_parse(PerlInterpreter *my_perl, XSINIT_t xsinit, int argc, char **argv, char **env) =back =back =for hackers Found in file perl.c =over 4 =item C X Tells a Perl interpreter to run its main program. See L for a tutorial. C points to the Perl interpreter. It must have been previously created through the use of L and L, and initialised through L. This function should not be called if L returned a non-zero value, indicating a failure in initialisation or compilation. This function executes code in C blocks, and then executes the main program. The code to be executed is that established by the prior call to L. If the interpreter's C word does not have the C flag set, then this function will also execute code in C blocks. If it is desired to make any further use of the interpreter after calling this function, then C blocks should be postponed to L time by setting that flag. Returns an integer of slightly tricky interpretation. The correct use of the return value is as a truth value indicating whether the program terminated non-locally. If zero is returned, this indicates that the program ran to completion, and it is safe to make other use of the interpreter (provided that the C flag was set as described above). If a non-zero value is returned, this indicates that the interpreter wants to terminate early. The interpreter should not be just abandoned because of this desire to terminate; the caller should proceed to shut the interpreter down cleanly with L and free it with L. For historical reasons, the non-zero return value also attempts to be a suitable value to pass to the C library function C (or to return from C
), to serve as an exit code indicating the nature of the way the program terminated. However, this isn't portable, due to differing exit code conventions. An attempt is made to return an exit code of the type required by the host operating system, but because it is constrained to be non-zero, it is not necessarily possible to indicate every type of exit. It is only reliable on Unix, where a zero exit code can be augmented with a set bit that will be ignored. In any case, this function is not the correct place to acquire an exit code: one should get that from L. =over 3 int perl_run(PerlInterpreter *my_perl) =back =back =for hackers Found in file perl.c =over 4 =item C Described in L. =over 3 void PERL_SET_CONTEXT(PerlInterpreter* i) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C =item C XX These provide system-specific tune up of the C runtime environment necessary to run Perl interpreters. Only one should be used, and it should be called only once, before creating any Perl interpreters. They differ in that C also initializes C. =over 3 void PERL_SYS_INIT (int *argc, char*** argv) void PERL_SYS_INIT3(int *argc, char*** argv, char*** env) =back =back =for hackers Found in file perl.h =over 4 =item C 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. =over 3 void PERL_SYS_TERM() =back =back =for hackers Found in file perl.h =over 4 =item C X Contains flags controlling perl's behaviour on exit(): =over =item * C If set, END blocks are executed when the interpreter is destroyed. This is normally set by perl itself after the interpreter is constructed. =item * C Call C on exit. This is used internally by perl itself to abort if exit is called while processing exit. =item * C Warn on exit. =item * C Set by the L operator. =back =over 3 U8 PL_exit_flags =back =back =for hackers Found in file intrpvar.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlembed.pod =over 4 =item C X This value may be set when embedding for full cleanup. Possible values: =over =item * 0 - none =item * 1 - full =item * 2 or greater - full with checks. =back If C<$ENV{PERL_DESTRUCT_LEVEL}> is set to an integer greater than the value of C its value is used instead. On threaded perls, each thread has an independent copy of this variable; each initialized at creation time with the current value of the creating thread's copy. =over 3 signed char PL_perl_destruct_level =back =back =for hackers Found in file intrpvar.h =over 4 =item C X Look for C in the pointer-mapping table C, returning its value, or NULL if not found. =over 3 void * ptr_table_fetch(PTR_TBL_t * const tbl, const void * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Clear and free a ptr table =over 3 void ptr_table_free(PTR_TBL_t * const tbl) =back =back =for hackers Found in file sv.c =over 4 =item C X Create a new pointer-mapping table =over 3 PTR_TBL_t * ptr_table_new() =back =back =for hackers Found in file sv.c =over 4 =item C X Double the hash bucket size of an existing ptr table =over 3 void ptr_table_split(PTR_TBL_t * const tbl) =back =back =for hackers Found in file sv.c =over 4 =item C X Add a new entry to a pointer-mapping table C. In hash terms, C is the key; Cnewsv> is the value. The names "old" and "new" are specific to the core's typical use of ptr_tables in thread cloning. =over 3 void ptr_table_store(PTR_TBL_t * const tbl, const void * const oldsv, void * const newsv) =back =back =for hackers Found in file sv.c =over 4 =item C 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 C form is B. =over 3 void require_pv(const char *pv) =back =back =for hackers Found in file perl.c =over 4 =item C X Like C> but the arguments are an encapsulated argument list. =over 3 void vload_module(U32 flags, SV *name, SV *ver, va_list *args) =back =back =for hackers Found in file op.c =head1 Errno =over 4 =item C X Generates the message string describing an OS error and returns it as an SV. C must be a value that C could take, identifying the type of error. If C is non-null then the string will be written into that SV (overwriting existing content) and it will be returned. If C is a null pointer then the string will be written into a new mortal SV which will be returned. The message will be taken from whatever locale would be used by C<$!>, and will be encoded in the SV in whatever manner would be used by C<$!>. The details of this process are subject to future change. Currently, the message is taken from the C locale by default (usually producing an English message), and from the currently selected locale when in the scope of the C pragma. A heuristic attempt is made to decode the message from the locale's character encoding, but it will only be decoded as either UTF-8 or ISO-8859-1. It is always correctly decoded in a UTF-8 locale, usually in an ISO-8859-1 locale, and never in any other locale. The SV is always returned containing an actual string, and with no other OK bits set. Unlike C<$!>, a message is even yielded for C zero (meaning success), and if no useful message is available then a useless string (currently empty) is returned. =over 3 SV * sv_string_from_errnum(int errnum, SV *tgtsv) =back =back =for hackers Found in file mg.c =head1 Exception Handling (simple) Macros =over 4 =item C X Set up necessary local variables for exception handling. See L. =over 3 dXCPT; =back =back =for hackers Found in file XSUB.h =over 4 =item C Described in L. =over 3 void JMPENV_JUMP(int v) =back =back =for hackers Found in file pod/perlinterp.pod =over 4 =item C Described in L. =over 3 void JMPENV_PUSH(int v) =back =back =for hackers Found in file pod/perlinterp.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlinterp.pod =over 4 =item C X Introduces a catch block. See L. =back =for hackers Found in file XSUB.h =over 4 =item C X Rethrows a previously caught exception. See L. =over 3 XCPT_RETHROW; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Ends a try block. See L. =back =for hackers Found in file XSUB.h =over 4 =item C X Starts a try block. See L. =back =for hackers Found in file XSUB.h =head1 Filesystem configuration values Also see L. =over 4 =item C X This symbol, if defined, indicates to the C program that the length of directory entry names is provided by a C field. Otherwise you need to do C on the C field. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C program should check the script that it is executing for setuid/setgid bits, and attempt to emulate setuid/setgid on systems that have disabled setuid #! scripts because the kernel can't do it securely. It is up to the package designer to make sure that this emulation is done securely. Among other things, it should do an fstat on the script it just opened to make sure it really is a setuid/setgid script, it should make sure the arguments passed correspond exactly to the argument on the #! line, and it should not trust any subprocesses to which it must pass the filename rather than the file descriptor of the script to be executed. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that a C on a non-blocking file descriptor will return 0 on C, and not the value held in C (-1 usually, in that case!). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C can be used for file locking. Normally on Unix systems this is defined. It may be undefined on C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, tells that to flush all pending stdio output one must loop through all the stdio file handles stored in an array and fflush them. Note that if C is defined, fflushall will not even be probed for and will be left undefined. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, tells that C correctly flushes all pending stdio output without side effects. In particular, on some platforms calling C *still* corrupts C if it is a pipe. =back =for hackers Found in file config.h =over 4 =item C X This macro is used to access the C<_base> field (or equivalent) of the C structure pointed to by its argument. This macro will always be defined if C is defined. =over 3 void * FILE_base(FILE * f) =back =back =for hackers Found in file handy.h =over 4 =item C X This macro is used to determine the number of bytes in the I/O buffer pointed to by C<_base> field (or equivalent) of the C structure pointed to its argument. This macro will always be defined if C is defined. =over 3 Size_t FILE_bufsiz(FILE *f) =back =back =for hackers Found in file handy.h =over 4 =item C X This macro is used to access the C<_cnt> field (or equivalent) of the C structure pointed to by its argument. This macro will always be defined if C is defined. =over 3 Size_t FILE_cnt(FILE * f) =back =back =for hackers Found in file handy.h =over 4 =item C X This macro is used to access the C<_ptr> field (or equivalent) of the C structure pointed to by its argument. This macro will always be defined if C is defined. =over 3 void * FILE_ptr(FILE * f) =back =back =for hackers Found in file handy.h =over 4 =item C X This symbol, if defined, indicates that the system supports filenames longer than 14 characters. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C* dirstream structure contains a member variable named C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to duplicate file descriptors. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to duplicate file descriptors. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the "fast stdio" is available to manipulate the stdio buffers directly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to change directory using a file descriptor. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that the C function exists. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to free a C structure without closing the underlying file descriptor. This function appeared in C 10.2. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C is available to determine file-system related limits and options associated with a given open file descriptor. =back =for hackers Found in file config.h =over 4 =item C X This symbol will be defined if the C compiler supports C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to stat filesystems by file descriptors. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to stat filesystems by file descriptors. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to stat filesystems in bulk. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to get filesystem mount info by filename. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to iterate through mounted file systems to get their info. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to query the mount options of file systems. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. A good guess is extern off_t lseek(int, off_t, int); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to create directories. Otherwise you should fork off a new process to exec F. =back =for hackers Found in file config.h =over 4 =item C X This symbol will be defined if the C compiler supports C. =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if the C routine is available. =back =for hackers Found in file config.h =over 4 =item C X This manifest constant lets the C program know that the three argument form of C is available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to C active file descriptors. Please check C and C to know which header should be included as well. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to read directory entries. You may have to include F. See C>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to readdir64 re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available. You may have to include F. See C>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to remove directories. Otherwise you should fork off a new process to exec F. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available. You may have to include F. See C>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C active file descriptors. If the timeout field is used, F may need to be included. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to change buffering on an open stdio stream. to a line-buffered mode. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, tells that there is an array holding the stdio streams. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C to do C is supported. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C to do C is supported. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C does have the C member containing the mount flags of the filesystem containing the file. This kind of C is coming from F (C 4.3), not from F (C). Older C (like Ultrix) do not have C and C, they have C and C with C and C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available. You may have to include F. See C>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C system call is available to query file system statistics by C. =back =for hackers Found in file config.h =over 4 =item C X This manifest constant tells the C program to include F. =over 3 #ifdef I_FCNTL #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F. =over 3 #ifdef I_SYS_DIR #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F to get definition of C and friends. =over 3 #ifdef I_SYS_FILE #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F. =over 3 #ifdef I_SYS_NDIR #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F exists. =over 3 #ifdef I_SYS_STATFS #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the number of bytes used by the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the return code from C when no data is present on the non-blocking file descriptor. Be careful! If C is not defined, then you can't distinguish between no data and C by issuing a C. You'll have to find another way to tell for sure! =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined to be the type of char used in F. It has the values "unsigned char" or "char". =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if the C macro can be used as an lvalue. =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if using the C macro as an lvalue to increase the pointer by n leaves C unchanged. =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if using the C macro as an lvalue to increase the pointer by n has the side effect of decreasing the value of C by n. =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if the C macro can be used as an lvalue. =back =for hackers Found in file config.h =over 4 =item C X This symbol tells the name of the array holding the stdio streams. Usual values include C<_iob>, C<__iob>, and C<__sF>. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the signedness of C's C. 1 for unsigned, -1 for signed. =back =for hackers Found in file config.h =over 4 =item C X This variable contains the size of C's C in bytes. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the errno error code set by C when no data was present on the non-blocking file descriptor. =back =for hackers Found in file config.h =over 4 =item C X This symbol is to be used during C or C to turn on non-blocking I/O for the file descriptor. Note that there is no way back, i.e. you cannot turn it blocking again this way. If you wish to alternatively switch between blocking and non-blocking, use the C call instead, but that is not supported by all devices. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine does not return a value. =back =for hackers Found in file config.h =head1 Floating point Also L lists capabilities that arent in this section. For example C, for the hyperbolic sine function. =over 4 =item C X This symbol contains flags that say what difficulties the compiler has casting odd floating values to unsigned long: 0 = ok 1 = couldn't cast < 0 2 = couldn't cast >= 0x80000000 4 = couldn't cast in argument expression list =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if the C compiler can cast negative numbers to unsigned longs, ints and shorts. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the double has the infinity. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the double has the not-a-number. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the double has the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the double has the subnormals (denormals). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, is a comma-separated list of hexadecimal bytes for the double precision infinity. =back =for hackers Found in file config.h =over 4 =item C X C will be one of C C C C C C C C C C C C C C C =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, tells how many mantissa bits there are in double precision floating point format. Note that this is usually C minus one, since with the standard C 754 formats C includes the implicit bit, which doesn't really exist. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, is a comma-separated list of hexadecimal bytes (0xHH) for the double precision not-a-number. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the size of a double, so that the C preprocessor can make decisions based on it. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the double is the 64-bit C mainframe format. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the double is the 64-bit C mainframe format. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the double is the 64-bit C 754. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the double is the 64-bit C format D or G. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to convert strings into long doubles. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to classify doubles. Available for example in C. The returned values are defined in F and are: FP_PLUS_NORM Positive normalized, nonzero FP_MINUS_NORM Negative normalized, nonzero FP_PLUS_DENORM Positive denormalized, nonzero FP_MINUS_DENORM Negative denormalized, nonzero FP_PLUS_ZERO +0.0 FP_MINUS_ZERO -0.0 FP_PLUS_INF +INF FP_MINUS_INF -INF FP_NANS Signaling Not a Number (NaNS) FP_NANQ Quiet Not a Number (NaNQ) =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether a double is C (non-infinity non-NaN). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether a long double is finite (non-infinity non-NaN). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to classify doubles. Available for example in Solaris/C. The returned values are defined in F and are: FP_SNAN signaling NaN FP_QNAN quiet NaN FP_NINF negative infinity FP_PINF positive infinity FP_NDENORM negative denormalized non-zero FP_PDENORM positive denormalized non-zero FP_NZERO negative zero FP_PZERO positive zero FP_NNORM negative normalized non-zero FP_PNORM positive normalized non-zero =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to classify doubles. Available for example in Digital C. The returned values are defined in F and are: FP_SNAN Signaling NaN (Not-a-Number) FP_QNAN Quiet NaN (Not-a-Number) FP_POS_INF +infinity FP_NEG_INF -infinity FP_POS_NORM Positive normalized FP_NEG_NORM Negative normalized FP_POS_DENORM Positive denormalized FP_NEG_DENORM Negative denormalized FP_POS_ZERO +0.0 (positive zero) FP_NEG_ZERO -0.0 (negative zero) =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to classify doubles. Available for example in HP-UX. The returned values are defined in F and are FP_NORMAL Normalized FP_ZERO Zero FP_INFINITE Infinity FP_SUBNORMAL Denormalized FP_NAN NaN =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to classify doubles. The values are defined in F FP_NORMAL Normalized FP_ZERO Zero FP_INFINITE Infinity FP_SUBNORMAL Denormalized FP_NAN NaN =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to classify long doubles. Available for example in C. The returned values are defined in F and are: FP_SNAN signaling NaN FP_QNAN quiet NaN FP_NINF negative infinity FP_PINF positive infinity FP_NDENORM negative denormalized non-zero FP_PDENORM positive denormalized non-zero FP_NZERO negative zero FP_PZERO positive zero FP_NNORM negative normalized non-zero FP_PNORM positive normalized non-zero =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to classify long doubles. Available for example in Digital C. See for possible values C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to get the floating point rounding mode. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to break a long double floating-point number into a normalized fraction and an integral power of 2. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to get integer exponent of a floating-point value. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether a double is finite (non-infinity non-NaN). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether a long double is finite. (non-infinity non-NaN). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether a double is an infinity. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether a long double is an infinity. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether a double is a NaN. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether a long double is a NaN. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether a double is normal (non-zero normalized). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that the C function is available for Bessel functions of the first kind of the order zero, for long doubles. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that the C function is available for Bessel functions of the first kind of the order zero, for doubles. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that this system's F or F defines the symbol C, which is the number of significant digits in a long double precision number. Unlike for C, there's no good guess for C if it is undefined. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to shift a long double floating-point number by an integral power of 2. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return the long long value closest to a double (according to the current rounding mode). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return the long long value closest to a long double (according to the current rounding mode). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return the nearest long long value away from zero of the long double argument value. =back =for hackers Found in file config.h =over 4 =item C X This symbol will be defined if the C compiler supports long doubles. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return the integral value closest to a double (according to the current rounding mode). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return the integral value closest to a long double (according to the current rounding mode). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return the nearest integral value away from zero of the long double argument value. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to split a long double x into a fractional part f and an integer part i such that |f| < 1.0 and (f + i) = x. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to generate NaN. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return the next machine representable long double from x in direction y. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return the floating-point C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to multiply floating-point number by integral power of radix. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check if the given number has the sign bit set. This should include correct testing of -0.0. This will only be set if the C routine is safe to use with the NV type used internally in perl. Users should call C, which will be #defined to the system's C function or macro if this symbol is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to do long double square roots. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to convert strings to long doubles. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to convert strings to long doubles. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to convert strings to long doubles. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to round doubles towards zero. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to check whether two doubles are C (effectively: whether either of them is NaN) =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F to get the floating point environment definitions. =over 3 #ifdef I_FENV #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F exists and should be included. =over 3 #ifdef I_QUADMATH #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, is a comma-separated list of hexadecimal bytes for the long double precision infinity. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, tells how many mantissa bits there are in long double precision floating point format. Note that this can be C minus one, since C can include the C 754 implicit bit. The common x86-style 80-bit long double does not have an implicit bit. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, is a comma-separated list of hexadecimal bytes (0xHH) for the long double precision not-a-number. =back =for hackers Found in file config.h =over 4 =item C X C will be one of C C C C C C C C C C C C C It is only defined if the system supports long doubles. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the size of a long double, so that the C preprocessor can make decisions based on it. It is only defined if the system supports long doubles. Note that this is C, which may include unused bytes. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the long double is any of the C 754 style long doubles: C, C, C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the long double is the 128-bit double-double. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the long double is the 80-bit C 754. Note that despite the 'extended' this is less than the 'std', since this is an extension of the double precision. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the long double is the 128-bit C 754. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the long double is the 128-bit C format H. =back =for hackers Found in file config.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X This symbol, if defined, tells how many mantissa bits (not including implicit bit) there are in a Perl NV. This depends on which floating point type was chosen. =back =for hackers Found in file config.h =over 4 =item C X This symbol gives the largest integer value that NVs can hold. This value + 1.0 cannot be stored accurately. It is expressed as constant floating point expression to reduce the chance of decimal/binary conversion issues. If it can not be determined, the value 0 is given. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that a variable of type C can preserve all the bits of a variable of type C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the number of bits a variable of type C can preserve of a variable of type C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the C. Note that some floating point formats have unused bytes. The most notable example is the x86* 80-bit extended precision which comes in byte sizes of 12 and 16 (for 32 and 64 bit platforms, respectively), but which only uses 10 bytes. Perl compiled with C<-Duselongdouble> on x86* is like this. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's NV. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that a variable of type C stores 0.0 in memory as all bits zero. =back =for hackers Found in file config.h =head1 General Configuration X This section contains configuration information not otherwise found in the more specialized sections of this document. At the end is a list of C<#defines> whose name should be enough to tell you what they do, and a list of #defines which tell you if you need to C<#include> files to get the corresponding functionality. =over 4 =item C X A preprocessor symbol that is defined iff the system is an ASCII platform; this symbol would not be defined on C> platforms. =over 3 #ifdef ASCIIish =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol holds the hexadecimal constant defined in byteorder, in a UV, i.e. 0x1234 or 0x4321 or 0x12345678, etc... If the compiler supports cross-compiling or multiple-architecture binaries, use compiler-defined macros to determine the byte order. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the size of a char, so that the C preprocessor can make decisions based on it. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, defines the major version number of Berkeley DB found in the F header when Perl was configured. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, defines the minor version number of Berkeley DB found in the F header when Perl was configured. For DB version 1 this is always 0. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, defines the patch version number of Berkeley DB found in the F header when Perl was configured. For DB version 1 this is always 0. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, removes the legacy default behavior of including '.' at the end of @C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that we need to prepend an underscore to the symbol name before calling C. This only makes sense if you *have* dlsym, which we will presume is the case if you're using F. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that this system uses C encoding. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C-shell exists. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C program may use the C routine to derive the host name. See also C> and C>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that the C C library is being used. A better check is to use the C<__GLIBC__> and C<__GLIBC_MINOR__> symbols supplied with glibc. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to do the log gamma function. See also C> and C>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to do the log gamma function without using the global signgam variable. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C compiler accepts, without error or warning, C that are declared with sizes other than plain 'int'; for example 'unsigned char' is accepted. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the prctl routine is available to set process title and supports C. =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if C is a symlink to the absolute pathname of the executing program. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that an emulation of the fork routine is available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to do some regular pattern matching (usually on C.2 conforming systems). =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to set process group ID. =back =for hackers Found in file config.h =over 4 =item C X This variable indicates to the C program that the C routine is available to save the calling process's registers and stack environment for later use by C, and to optionally save the process's signal mask. See C>, C>, and C>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C is supported. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C is supported. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to do the gamma function. See also C>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C program may use the C routine to derive the host name. See also C> and C>. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C is defined by including F. If not, the user code probably needs to define it as: union semun { int val; struct semid_ds *buf; unsigned short *array; } =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F. Using this symbol also triggers the definition of the C define which ends up being 'C' or 'C' depending on the availability of F. =over 3 #ifdef I_DIRENT #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F exists and should be included. (see also C>) =over 3 #ifdef I_POLL #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F. =over 3 #ifdef I_SYS_RESOURCE #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that libm exports C<_LIB_VERSION> and that F defines the enum to manipulate it. =back =for hackers Found in file config.h =over 4 =item C This symbol, if defined, indicates that the system stores the variable argument list datatype, C, in a format that cannot be copied by simple assignment, so that some other means must be used when copying is required. As such systems vary in their provision (or non-provision) of copying mechanisms, F defines a platform- independent macro, C, to do the job. =back =for hackers Found in file pod/perlhacktips.pod =over 4 =item C X This symbol contains the name of the operating system, as determined by Configure. You shouldn't rely on it too much; the specific feature tests from Configure are generally more reliable. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the version of the operating system, as determined by Configure. You shouldn't rely on it too much; the specific feature tests from Configure are generally more reliable. =back =for hackers Found in file config.h =over 4 =item C X This C pre-processor value, if defined, indicates that it is permissible to use the GCC brace groups extension. However, use of this extension is DISCOURAGED. Use a C function instead. The extension, of the form ({ statement ... }) turns the block consisting of I into an expression with a value, unlike plain C language blocks. This can present optimization possibilities, B, unless you know for sure that this will never be compiled without this extension being available and not forbidden, you need to specify an alternative. Thus two code paths have to be maintained, which can get out-of-sync. All these issues are solved by using a C function instead. Perl can be configured to not use this feature by passing the parameter C<-Accflags=-DPERL_GCC_BRACE_GROUPS_FORBIDDEN> to F. =over 3 #ifdef PERL_USE_GCC_BRACE_GROUPS =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol, if defined, indicates the command to feed to the C routine to derive the host name. See also C> and C>. Note that the command uses a fully qualified path, so that it is safe even if used by a process with super-user privileges. =back =for hackers Found in file config.h =over 4 =item C X If C is defined this symbol is the filename of the symbolic link pointing to the absolute pathname of the executing program. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the size of a pointer, so that the C preprocessor can make decisions based on it. It will be C if the compiler supports (void *); otherwise it will be C. =back =for hackers Found in file config.h =over 4 =item C X This symbol indicates how many bits are produced by the function used to generate normalized random numbers. Values include 15, 16, 31, and 48. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the minimum number of bits operated by select. That is, if you do C, how many bits at least will be cleared in the masks if some activity is detected. Usually this is either n or 32*C, especially many little-endians do the latter. This is only useful if you have C, naturally. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the bug that prevents setuid scripts from being secure is not present in this kernel. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the signedness of C's C. 1 for unsigned, -1 for signed. =back =for hackers Found in file config.h =over 4 =item C X This variable contains the size of C's C in bytes. =back =for hackers Found in file config.h =head2 List of capability C> symbols This is a list of those symbols that dont appear elsewhere in ths document that indicate if the current platform has a certain capability. Their names all begin with C. Only those symbols whose capability is directly derived from the name are listed here. All others have their meaning expanded out elsewhere in this document. This (relatively) compact list is because we think that the expansion would add little or no value and take up a lot of space (because there are so many). If you think certain ones should be expanded, send email to L. Each symbol here will be C<#define>d if and only if the platform has the capability. If you need more detail, see the corresponding entry in F. For convenience, the list is split so that the ones that indicate there is a reentrant version of a capability are listed separately C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C And, the reentrant capabilities: C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C Example usage: =over 4 #ifdef HAS_STRNLEN use strnlen() #else use an alternative implementation #endif =back =head2 List of C<#include> needed symbols This list contains symbols that indicate if certain C<#include> files are present on the platform. If your code accesses the functionality that one of these is for, you will need to C<#include> it if the symbol on this list is C<#define>d. For more detail, see the corresponding entry in F. C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C,S< > C Example usage: =over 4 #ifdef I_WCHAR #include #endif =back =head1 Global Variables These variables are global to an entire process. They are shared between all interpreters and all threads in a process. Any variables not documented here may be changed or removed without notice, so don't use them! If you feel you really do need to use an unlisted variable, first send email to L. It may be that someone there will point out a way to accomplish what you need without using an internal variable. But if not, you should get a go-ahead to document and then use the variable. =over 4 =item C X Array, indexed by opcode, of functions that will be called for the "check" phase of optree building during compilation of Perl code. For most (but not all) types of op, once the op has been initially built and populated with child ops it will be filtered through the check function referenced by the appropriate element of this array. The new op is passed in as the sole argument to the check function, and the check function returns the completed op. The check function may (as the name suggests) check the op for validity and signal errors. It may also initialise or modify parts of the ops, or perform more radical surgery such as adding or removing child ops, or even throw the op away and return a different op in its place. This array of function pointers is a convenient place to hook into the compilation process. An XS module can put its own custom check function in place of any of the standard ones, to influence the compilation of a particular type of op. However, a custom check function must never fully replace a standard check function (or even a custom check function from another module). A module modifying checking must instead B the preexisting check function. A custom check function must be selective about when to apply its custom behaviour. In the usual case where it decides not to do anything special with an op, it must chain the preexisting op function. Check functions are thus linked in a chain, with the core's base checker at the end. For thread safety, modules should not write directly to this array. Instead, use the function L. =back =for hackers Found in file perlvars.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. B This API exists entirely for the purpose of making the CPAN module C work. It is not expected that additional modules will make use of it; rather, that they should use C to provide parsing of new infix operators. Function pointer, pointing at a function used to handle extended infix operators. The function should be declared as int infix_plugin_function(pTHX_ char *opname, STRLEN oplen, struct Perl_custom_infix **infix_ptr) The function is called from the tokenizer whenever a possible infix operator is seen. C points to the operator name in the parser's input buffer, and C gives the I number of bytes of it that should be consumed; it is not null-terminated. The function is expected to examine the operator name and possibly other state such as L<%^H|perlvar/%^H>, to determine whether it wants to handle the operator name. As compared to the single stage of C, parsing of additional infix operators occurs in three separate stages. This is because of the more complex interactions it has with the parser, to ensure that operator precedence rules work correctly. These stages are co-ordinated by the use of an additional information structure. If the function wants to handle the infix operator, it must set the variable pointed to by C to the address of a structure that provides this additional information about the subsequent parsing stages. If it does not, it should make a call to the next function in the chain. This structure has the following definition: struct Perl_custom_infix { enum Perl_custom_infix_precedence prec; void (*parse)(pTHX_ SV **opdata, struct Perl_custom_infix *); OP *(*build_op)(pTHX_ SV **opdata, OP *lhs, OP *rhs, struct Perl_custom_infix *); }; The function must then return an integer giving the number of bytes consumed by the name of this operator. In the case of an operator whose name is composed of identifier characters, this must be equal to C. In the case of an operator named by non-identifier characters, this is permitted to be shorter than C, and any additional characters after it will not be claimed by the infix operator but instead will be consumed by the tokenizer and parser as normal. If the optional C function is provided, it is called immediately by the parser to let the operator's definition consume any additional syntax from the source code. This should I be used for normal operand parsing, but it may be useful when implementing things like parametric operators or meta-operators that consume more syntax themselves. This function may use the variable pointed to by C to provide an SV containing additional data to be passed into the C function later on. The information structure gives the operator precedence level in the C field. This is used to tell the parser how much of the surrounding syntax before and after should be considered as operands to the operator. The tokenizer and parser will then continue to operate as normal until enough additional input has been parsed to form both the left- and right-hand side operands to the operator, according to the precedence level. At this point the C function is called, being passed the left- and right-hand operands as optree fragments. It is expected to combine them into the resulting optree fragment, which it should return. After the C function has returned, if the variable pointed to by C was set to a non-C value, it will then be destroyed by calling C. For thread safety, modules should not set this variable directly. Instead, use the function L. However, that all said, the introductory note above still applies. This variable is provided in core perl only for the benefit of the C module. That module acts as a central registry for infix operators, automatically handling things like deparse support and discovery/reflection, and these abilities only work because it knows all the registered operators. Other modules should not use this interpreter variable directly to implement them because then those central features would no longer work properly. Furthermore, it is likely that this (experimental) API will be replaced in a future Perl version by a more complete API that fully implements the central registry and other semantics currently provided by C, once the module has had sufficient experimental testing time. This current mechanism exists only as an interim measure to get to that stage. =back =for hackers Found in file perlvars.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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. For thread safety, modules should not set this variable directly. Instead, use the function L. =back =for hackers Found in file perlvars.h =over 4 =item C X A value that indicates the current Perl interpreter's phase. Possible values include C, C, C, C, C, C, and C. For example, the following determines whether the interpreter is in global destruction: if (PL_phase == PERL_PHASE_DESTRUCT) { // we are in global destruction } C was introduced in Perl 5.14; in prior perls you can use C (boolean) to determine whether the interpreter is in global destruction. (Use of C is discouraged since 5.14.) =over 3 enum perl_phase PL_phase =back =back =for hackers Found in file perlvars.h =head1 GV Handling and Stashes XXXXXXXXXXXX A GV is a structure which corresponds to to a Perl typeglob, ie *foo. It is a structure that holds a pointer to a scalar, an array, a hash etc, corresponding to $foo, @foo, %foo. GVs are usually found as values in stashes (symbol table hashes) where Perl stores its global variables. A B is a hash that contains all variables that are defined within a package. See L =over 4 =item C X Perform the overloaded (active magic) operation given by C. C is one of the values found in F. C affects how the operation is performed, as follows: =over =item C C is not to be used in this operation. =item C C is not to be used in this operation. =item C The operation is done only on just one operand. =item C The operation changes one of the operands, e.g., $x += 1 =back =over 3 SV * amagic_call(SV *left, SV *right, int method, int dir) =back =back =for hackers Found in file gv.c =over 4 =item C X Perform C overloading dereferencing on C, returning the dereferenced result. C must be one of the dereference operations given in F. If overloading is inactive on C, returns C itself. =over 3 SV * amagic_deref_call(SV *ref, int method) =back =back =for hackers Found in file gv.c =over 4 =item C X Make sure there is a slot of type C in the GV C. =over 3 GV * gv_add_by_type(GV *gv, svtype type) =back =back =for hackers Found in file gv.c =over 4 =item C X Recalculates overload magic in the package given by C. Returns: =over =item 1 on success and there is some overload =item 0 if there is no overload =item -1 if some error occurred and it couldn't croak (because C is true). =back =over 3 int Gv_AMupdate(HV *stash, bool destructing) =back =back =for hackers Found in file gv.c =over 4 =item C =item C =item C XXX These each search for an C method, returning NULL if not found, or else returning a pointer to its GV, while setting the package L|perlobj/AUTOLOAD> variable to C (fully qualified). Also, if found and the GV's CV is an XSUB, the CV's PV will be set to C, and its stash will be set to the stash of the GV. Searching is done in L order|perlmroapi>, as specified in L>, beginning with C if it isn't NULL. The forms differ only in how C is specified. In C, C is a C language NUL-terminated string. In C, C points to the first byte of the name, and an additional parameter, C, specifies its length in bytes. Hence, C<*name> may contain embedded-NUL characters. In C, C<*namesv> is an SV, and the name is the PV extracted from that using L>. If the SV is marked as being in UTF-8, the extracted PV will also be. =over 3 GV * gv_autoload_pv (HV *stash, const char *namepv, U32 flags) GV * gv_autoload_pvn(HV *stash, const char *name, STRLEN len, U32 flags) GV * gv_autoload_sv (HV *stash, SV *namesv, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X Equivalent to C>. =over 3 GV * gv_autoload4(HV *stash, const char *name, STRLEN len, I32 method) =back =back =for hackers Found in file gv.h =over 4 =item C X Return the AV from the GV. =over 3 AV* GvAV(GV* gv) =back =back =for hackers Found in file gv.h =over 4 =item C =item C =item C =item C XXXX Make sure there is a slot of the given type (AV, HV, IO, SV) in the GV C. =over 3 GV * gv_AVadd(GV *gv) =back =back =for hackers Found in file gv.h =over 4 =item C 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 C. =over 3 SV * gv_const_sv(GV *gv) =back =back =for hackers Found in file gv.c =over 4 =item C X Return the CV from the GV. =over 3 CV* GvCV(GV* gv) =back =back =for hackers Found in file gv.h =over 4 =item C =item C =item C =item C XXXX Place the full package name of C into C. The C forms return instead the effective package name (see L). If C is non-NULL, it is considered to be a C language NUL-terminated string, and the stored name will be prefaced with it. The other difference between the functions is that the C<*4> forms have an extra parameter, C. If C an initial C in the name is kept; if C it is stripped. With the C<*3> forms, it is always kept. =over 3 void gv_efullname3(SV *sv, const GV *gv, const char *prefix) void gv_efullname4(SV *sv, const GV *gv, const char *prefix, bool keepmain) void gv_fullname3 (SV *sv, const GV *gv, const char *prefix) void gv_fullname4 (SV *sv, const GV *gv, const char *prefix, bool keepmain) =back =back =for hackers Found in file gv.c =over 4 =item C =item C XX These return the debugger glob for the file (compiled by Perl) whose name is given by the C parameter. There are currently exactly two differences between these functions. The C parameter to C is a C string, meaning it is C-terminated; whereas the C parameter to C is a Perl string, whose length (in bytes) is passed in via the C parameter This means the name may contain embedded C characters. C doesn't exist in plain C). The other difference is that C has an extra C parameter, which is currently completely ignored, but allows for possible future extensions. =over 3 GV * gv_fetchfile (const char *name) GV * gv_fetchfile_flags(const char * const name, const STRLEN len, const U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C =item C =item C =item C XXXX These each look for a glob with name C, containing a defined subroutine, returning the GV of that glob if found, or C if not. C is always searched (first), unless it is C. If C is NULL, or was searched but nothing was found in it, and the C bit is set in C, stashes accessible via C<@ISA> are searched next. Searching is conducted according to L order|perlmroapi>. Finally, if no matches were found so far, and the C flag in C is not set, C is searched. The argument C should be either 0 or -1. If -1, the function will return without any side effects or caching. If 0, the function makes sure there is a glob named C in C, creating one if necessary. The subroutine slot in the glob will be set to any subroutine found in the C and C search, hence caching any C result. Note that subroutines found in C are not cached. The GV returned from these 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. The only other significant value for C is C, indicating that C is to be treated as being encoded in UTF-8. Plain C lacks a C parameter, hence always searches in C, then C, and C is never UTF-8. Otherwise it is exactly like C. The other forms do have a C parameter, and differ only in how the glob name is specified. In C, C is a C language NUL-terminated string. In C, C points to the first byte of the name, and an additional parameter, C, specifies its length in bytes. Hence, the name may contain embedded-NUL characters. In C, C<*name> is an SV, and the name is the PV extracted from that, using L>. If the SV is marked as being in UTF-8, the extracted PV will also be. =over 3 GV * gv_fetchmeth (HV *stash, const char *name, STRLEN len, I32 level) GV * gv_fetchmeth_pv (HV *stash, const char *name, I32 level, U32 flags) GV * gv_fetchmeth_pvn(HV *stash, const char *name, STRLEN len, I32 level, U32 flags) GV * gv_fetchmeth_sv (HV *stash, SV *namesv, I32 level, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X This is the old form of L, which has no flags parameter. =over 3 GV * gv_fetchmeth_autoload(HV *stash, const char *name, STRLEN len, I32 level) =back =back =for hackers Found in file gv.c =over 4 =item C X See L. =over 3 GV * gv_fetchmethod(HV *stash, const char *name) =back =back =for hackers Found in file mathoms.c =over 4 =item C 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 C<$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 C<$AUTOLOAD> changing its value. Use the glob created as a side effect to do this. These functions have the same side-effects as C with C. The warning against passing the GV returned by C to C applies equally to these functions. =over 3 GV * gv_fetchmethod_autoload(HV *stash, const char *name, I32 autoload) =back =back =for hackers Found in file gv.c =over 4 =item C X Exactly like L, but takes a nul-terminated string instead of a string/length pair. =over 3 GV * gv_fetchmeth_pv_autoload(HV *stash, const char *name, I32 level, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X Same as C, 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, C of the result may be zero. Currently, the only significant value for C is C. =over 3 GV * gv_fetchmeth_pvn_autoload(HV *stash, const char *name, STRLEN len, I32 level, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X Exactly like L, but takes the name string in the form of an SV instead of a string/length pair. =over 3 GV * gv_fetchmeth_sv_autoload(HV *stash, SV *namesv, I32 level, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C =item C =item C =item C =item C =item C XXXXXX These all return the GV of type C whose name is given by the inputs, or NULL if no GV of that name and type could be found. See L. The only differences are how the input name is specified, and if 'get' magic is normally used in getting that name. Don't be fooled by the fact that only one form has C in its name. They all have a C parameter in fact, and all the flag bits have the same meanings for all If any of the flags C, C, C, C, or C is set, a GV is created if none already exists for the input name and type. However, C will only do the creation for magical GV's. For all of these flags except C, C> is called after the addition. C is used when the caller expects that adding won't be necessary because the symbol should already exist; but if not, add it anyway, with a warning that it was unexpectedly absent. The C flag means to pretend that the GV has been seen before (I, suppress "Used once" warnings). The flag C causes C> not be to called if the GV existed but isn't PVGV. If the C bit is set, the name is treated as being encoded in UTF-8; otherwise the name won't be considered to be UTF-8 in the C-named forms, and the UTF-8ness of the underlying SVs will be used in the C forms. If the flag C is set, the caller warrants that the input name is a plain symbol name, not qualified with a package, otherwise the name is checked for being a qualified one. In C, C is a C string, NUL-terminated with no intermediate NULs. In C, C is a literal C string, hence is enclosed in double quotes. C and C are identical. In these, is a Perl string whose byte length is given by C, and may contain embedded NULs. In C and C, the name is extracted from the PV of the input C SV. The only difference between these two forms is that 'get' magic is normally done on C in C, and always skipped with C. Including C in the C parameter to C makes it behave identically to C. =over 3 GV * gv_fetchpv (const char *nambeg, I32 flags, const svtype sv_type) GV * gv_fetchpvn (const char * nambeg, STRLEN full_len, I32 flags, const svtype sv_type) GV * gv_fetchpvn_flags(const char *name, STRLEN len, I32 flags, const svtype sv_type) GV * gv_fetchpvs ("name", I32 flags, const svtype sv_type) GV * gv_fetchsv (SV *name, I32 flags, const svtype sv_type) GV * gv_fetchsv_nomg (SV *name, I32 flags, const svtype sv_type) =back =back =for hackers Found in file gv.c =over 4 =item C X Return the HV from the GV. =over 3 HV* GvHV(GV* gv) =back =back =for hackers Found in file gv.h =over 4 =item C X The old form of C. It does not work with UTF-8 strings, as it has no flags parameter. If the C parameter is set, the C flag will be passed to C. =over 3 void gv_init(GV *gv, HV *stash, const char *name, STRLEN len, int multi) =back =back =for hackers Found in file gv.c =over 4 =item C X Same as C, but takes a nul-terminated string for the name instead of separate char * and length parameters. =over 3 void gv_init_pv(GV *gv, HV *stash, const char *name, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X Converts a scalar into a typeglob. This is an incoercible typeglob; assigning a reference to it will assign to one of its slots, instead of overwriting it as happens with typeglobs created by C. Converting any scalar that is C may produce unpredictable results and is reserved for perl's internal use. C is the scalar to be converted. C is the parent stash/package, if any. C and C give the name. The name must be unqualified; that is, it must not include the package name. If C is a stash element, it is the caller's responsibility to ensure that the name passed to this function matches the name of the element. If it does not match, perl's internal bookkeeping will get out of sync. C can be set to C if C is a UTF-8 string, or the return value of SvUTF8(sv). It can also take the C flag, which means to pretend that the GV has been seen before (i.e., suppress "Used once" warnings). =over 3 void gv_init_pvn(GV *gv, HV *stash, const char *name, STRLEN len, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X Same as C, but takes an SV * for the name instead of separate char * and length parameters. C is currently unused. =over 3 void gv_init_sv(GV *gv, HV *stash, SV *namesv, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X Set the name for GV C to C which is C bytes long. Thus it may contain embedded NUL characters. If C contains C, the name is treated as being encoded in UTF-8; otherwise not. =over 3 void gv_name_set(GV *gv, const char *name, U32 len, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X Returns a pointer to the stash for a specified package. Uses C to determine the length of C, then calls C. =over 3 HV * gv_stashpv(const char *name, I32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C 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 C is returned. Flags may be one of: GV_ADD Create and initialize the package if doesn't already exist GV_NOADD_NOINIT Don't create the package, GV_ADDMG GV_ADD iff the GV is magical GV_NOINIT GV_ADD, but don't initialize GV_NOEXPAND Don't expand SvOK() entries to PVGV SVf_UTF8 The name is in UTF-8 The most important of which are probably C and C. Note, use of C instead of C where possible is strongly recommended for performance reasons. =over 3 HV * gv_stashpvn(const char *name, U32 namelen, I32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 HV* gv_stashpvs("name", I32 create) =back =back =for hackers Found in file handy.h =over 4 =item C X Returns a pointer to the stash for a specified package. See C>. Note this interface is strongly preferred over C for performance reasons. =over 3 HV * gv_stashsv(SV *sv, I32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X Return the SV from the GV. Prior to Perl v5.9.3, this would add a scalar if none existed. Nowadays, use C> for that, or compile perl with S>. See L. =over 3 SV* GvSV(GV* gv) =back =back =for hackers Found in file gv.h =over 4 =item C X Like C>, but creates an empty scalar if none already exists. =over 3 SV* GvSVn(GV* gv) =back =back =for hackers Found in file gv.h =over 4 =item C =item C XX Create a new, guaranteed to be unique, GV in the package given by the NUL-terminated C language string C, and return a pointer to it. For C or if C in C is 0, C is to be considered to be encoded in Latin-1. The only other legal C value is C, which indicates C is to be considered to be encoded in UTF-8. =over 3 GV * newGVgen (const char *pack) GV * newGVgen_flags(const char *pack, U32 flags) =back =back =for hackers Found in file gv.c =over 4 =item C X The stash for the package code will be compiled into. On threaded perls, each thread has an independent copy of this variable; each initialized at creation time with the current value of the creating thread's copy. =over 3 HV* PL_curstash =back =back =for hackers Found in file intrpvar.h =over 4 =item C X The GV representing C<*_>. Useful for access to C<$_>. On threaded perls, each thread has an independent copy of this variable; each initialized at creation time with the current value of the creating thread's copy. =over 3 GV * PL_defgv =back =back =for hackers Found in file intrpvar.h =over 4 =item C X See C>. =back =for hackers Found in file pp_sys.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Saves the current GP of gv on the save stack to be restored on scope exit. If C is true, replace the GP with a new GP. If C is false, mark C with C so the next reference assigned is localized, which is how S> works. =over 3 void save_gp(GV *gv, I32 empty) =back =back =for hackers Found in file scope.c =over 4 =item C X Sets C, the default file handle for output, to the passed in typeglob. As C "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 C points to is decreased by one. =over 3 void setdefout(GV *gv) =back =back =for hackers Found in file pp_sys.c =head1 Hook manipulation These functions provide convenient and thread-safe means of manipulating hook variables. =over 4 =item C X refcount increment a shared memory refcounted string, and when the refcount goes to 0 free it using PerlMemShared_free(). It is the callers responsibility to ensure that the pv is the result of a rcpv_new() call. Returns the same pointer that was passed in. new = rcpv_copy(pv); =over 3 char * rcpv_copy(char * const pv) =back =back =for hackers Found in file op.c =over 4 =item C X refcount decrement a shared memory refcounted string, and when the refcount goes to 0 free it using perlmemshared_free(). it is the callers responsibility to ensure that the pv is the result of a rcpv_new() call. Always returns NULL so it can be used like this: thing = rcpv_free(thing); =over 3 char * rcpv_free(char * const pv) =back =back =for hackers Found in file op.c =over 4 =item C X Create a new shared memory refcounted string with the requested size, and with the requested initialization and a refcount of 1. The actual space allocated will be 1 byte more than requested and rcpv_new() will ensure that the extra byte is a null regardless of any flags settings. If the RCPVf_NO_COPY flag is set then the pv argument will be ignored, otherwise the contents of the pv pointer will be copied into the new buffer or if it is NULL the function will do nothing and return NULL. If the RCPVf_USE_STRLEN flag is set then the len argument is ignored and recomputed using C. It is an error to combine RCPVf_USE_STRLEN and RCPVf_NO_COPY at the same time. Under DEBUGGING rcpv_new() will assert() if it is asked to create a 0 length shared string unless the RCPVf_ALLOW_EMPTY flag is set. The return value from the function is suitable for passing into rcpv_copy() and rcpv_free(). To access the RCPV * from the returned value use the RCPVx() macro. The 'len' member of the RCPV struct stores the allocated length (including the extra byte), but the RCPV_LEN() macro returns the requested length (not including the extra byte). Note that rcpv_new() does NOT use a hash table or anything like that to dedupe inputs given the same text content. Each call with a non-null pv parameter will produce a distinct pointer with its own refcount regardless of the input content. =over 3 char * rcpv_new(const char * const pv, STRLEN len, U32 flags) =back =back =for hackers Found in file op.c =over 4 =item C X Puts a C function into the chain of check functions for a specified op type. This is the preferred way to manipulate the L array. C specifies which type of op is to be affected. C is a pointer to the C function that is to be added to that opcode's check chain, and C points to the storage location where a pointer to the next function in the chain will be stored. The value of C is written into the L array, while the value previously stored there is written to C<*old_checker_p>. L is global to an entire process, and a module wishing to hook op checking may find itself invoked more than once per process, typically in different threads. To handle that situation, this function is idempotent. The location C<*old_checker_p> must initially (once per process) contain a null pointer. A C variable of static duration (declared at file scope, typically also marked C to give it internal linkage) will be implicitly initialised appropriately, if it does not have an explicit initialiser. This function will only actually modify the check chain if it finds C<*old_checker_p> to be null. This function is also thread safe on the small scale. It uses appropriate locking to avoid race conditions in accessing L. When this function is called, the function referenced by C must be ready to be called, except for C<*old_checker_p> being unfilled. In a threading situation, C may be called immediately, even before this function has returned. C<*old_checker_p> will always be appropriately set before C is called. If C decides not to do anything special with an op that it is given (which is the usual case for most uses of op check hooking), it must chain the check function referenced by C<*old_checker_p>. Taken all together, XS code to hook an op checker should typically look something like this: static Perl_check_t nxck_frob; static OP *myck_frob(pTHX_ OP *op) { ... op = nxck_frob(aTHX_ op); ... return op; } BOOT: wrap_op_checker(OP_FROB, myck_frob, &nxck_frob); If you want to influence compilation of calls to a specific subroutine, then use L rather than hooking checking of all C ops. =over 3 void wrap_op_checker(Optype opcode, Perl_check_t new_checker, Perl_check_t *old_checker_p) =back =back =for hackers Found in file op.c =head1 HV Handling XXX A HV structure represents a Perl hash. It consists mainly of an array of pointers, each of which points to a linked list of HE structures. The array is indexed by the hash function of the key, so each linked list represents all the hash entries with the same hash value. Each HE contains a pointer to the actual value, plus a pointer to a HEK structure which holds the key and hash value. =over 4 =item C 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 (ignoring C) and the variable does not exist then C is returned. NOTE: the C form is B. =over 3 HV * get_hv(const char *name, I32 flags) =back =back =for hackers Found in file perl.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C 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). =back =for hackers Found in file hv.h =over 4 =item C X Returns the computed hash stored in the hash entry. =over 3 U32 HeHASH(HE* he) =back =back =for hackers Found in file hv.h =over 4 =item C 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. =over 3 void* HeKEY(HE* he) =back =back =for hackers Found in file hv.h =over 4 =item C 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. =over 3 STRLEN HeKLEN(HE* he) =back =back =for hackers Found in file hv.h =over 4 =item C 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. =over 3 char* HePV(HE* he, STRLEN len) =back =back =for hackers Found in file hv.h =over 4 =item C X Returns the key as an C, or C if the hash entry does not contain an C key. =over 3 SV* HeSVKEY(HE* he) =back =back =for hackers Found in file hv.h =over 4 =item C X Returns the key as an C. Will create and return a temporary mortal C if the hash entry contains only a C key. =over 3 SV* HeSVKEY_force(HE* he) =back =back =for hackers Found in file hv.h =over 4 =item C 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. =over 3 SV* HeSVKEY_set(HE* he, SV* sv) =back =back =for hackers Found in file hv.h =over 4 =item C 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. =over 3 U32 HeUTF8(HE* he) =back =back =for hackers Found in file hv.h =over 4 =item C X Returns the value slot (type C) stored in the hash entry. Can be assigned to. SV *foo= HeVAL(hv); HeVAL(hv)= sv; =over 3 SV* HeVAL(HE* he) =back =back =for hackers Found in file hv.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Check that a hash is in an internally consistent state. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_hv_assert(pTHX_ HV *hv) =back =back =for hackers Found in file hv.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. If the hash is tied dispatches through to the SCALAR tied method, otherwise if the hash contains no keys returns 0, otherwise returns a mortal sv containing a string specifying the number of used buckets, followed by a slash, followed by the number of available buckets. This function is expensive, it must scan all of the buckets to determine which are used, and the count is NOT cached. In a large hash this could be a lot of buckets. =over 3 SV * hv_bucket_ratio(HV *hv) =back =back =for hackers Found in file hv.c =over 4 =item C X Frees all the elements of a hash, leaving it empty. The XS equivalent of C<%hash = ()>. See also L. See L for a note about the hash possibly being invalid on return. =over 3 void hv_clear(HV *hv) =back =back =for hackers Found in file hv.c =over 4 =item C 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 C<&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 C> for an example of its use. =over 3 void hv_clear_placeholders(HV *hv) =back =back =for hackers Found in file hv.c =over 4 =item C X A specialised version of L for copying C<%^H>. C 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 C is copied to a new hash, which has the C<%^H>-specific magic added to it. A pointer to the new hash is returned. =over 3 HV * hv_copy_hints_hv(HV * const ohv) =back =back =for hackers Found in file hv.c =over 4 =item C 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 absolute value of C is the length of the key. If C is negative the key is assumed to be in UTF-8-encoded Unicode. The C value will normally be zero; if set to C then C will be returned. C will also be returned if the key is not found. =over 3 SV * hv_delete(HV *hv, const char *key, I32 klen, I32 flags) =back =back =for hackers Found in file hv.c =over 4 =item C 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 C then C will be returned. C 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. =over 3 SV * hv_delete_ent(HV *hv, SV *keysv, I32 flags, U32 hash) =back =back =for hackers Found in file hv.c =over 4 =item C 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. =over 3 char* HvENAME(HV* stash) =back =back =for hackers Found in file hv.h =over 4 =item C X Returns the length of the stash's effective name. =over 3 STRLEN HvENAMELEN(HV *stash) =back =back =for hackers Found in file hv.h =over 4 =item C X Returns true if the effective name is in UTF-8 encoding. =over 3 unsigned char HvENAMEUTF8(HV *stash) =back =back =for hackers Found in file hv.h =over 4 =item C X Returns a boolean indicating whether the specified hash key exists. The absolute value of C is the length of the key. If C is negative the key is assumed to be in UTF-8-encoded Unicode. =over 3 bool hv_exists(HV *hv, const char *key, I32 klen) =back =back =for hackers Found in file hv.c =over 4 =item C 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. =over 3 bool hv_exists_ent(HV *hv, SV *keysv, U32 hash) =back =back =for hackers Found in file hv.c =over 4 =item C X Returns the SV which corresponds to the specified key in the hash. The absolute value of C is the length of the key. If C is negative the key is assumed to be in UTF-8-encoded Unicode. If C is set then the fetch will be part of a store. This means that if there is no value in the hash associated with the given key, then one is created and a pointer to it is returned. The C it points to can be assigned to. But always 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. =over 3 SV ** hv_fetch(HV *hv, const char *key, I32 klen, I32 lval) =back =back =for hackers Found in file hv.c =over 4 =item C 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. =over 3 HE * hv_fetch_ent(HV *hv, SV *keysv, I32 lval, U32 hash) =back =back =for hackers Found in file hv.c =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 SV** hv_fetchs(HV* tb, "key", I32 lval) =back =back =for hackers Found in file handy.h =over 4 =item C X Returns the number of hash buckets that happen to be in use. As of perl 5.25 this function is used only for debugging purposes, and the number of used hash buckets is not in any way cached, thus this function can be costly to execute as it must iterate over all the buckets in the hash. =over 3 STRLEN HvFILL(HV *const hv) =back =back =for hackers Found in file hv.h =over 4 =item C X Returns true if the HV has a C extension. Use this to check whether it is valid to call C. =over 3 bool HvHasAUX(HV *const hv) =back =back =for hackers Found in file hv.h =over 4 =item C X Prepares a starting point to traverse a hash table. Returns the number of keys in the hash, including placeholders (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. =over 3 I32 hv_iterinit(HV *hv) =back =back =for hackers Found in file hv.c =over 4 =item C X Returns the key from the current position of the hash iterator. See C>. =over 3 char * hv_iterkey(HE *entry, I32 *retlen) =back =back =for hackers Found in file hv.c =over 4 =item C 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>. =over 3 SV * hv_iterkeysv(HE *entry) =back =back =for hackers Found in file hv.c =over 4 =item C 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. =over 3 HE * hv_iternext(HV *hv) =back =back =for hackers Found in file hv.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Returns entries from a hash iterator. See C> and C>. The C value will normally be zero; if C 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<&PL_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. =over 3 HE * hv_iternext_flags(HV *hv, I32 flags) =back =back =for hackers Found in file hv.c =over 4 =item C X Performs an C, C, and C in one operation. =over 3 SV * hv_iternextsv(HV *hv, char **key, I32 *retlen) =back =back =for hackers Found in file hv.c =over 4 =item C X Returns the value from the current position of the hash iterator. See C>. =over 3 SV * hv_iterval(HV *hv, HE *entry) =back =back =for hackers Found in file hv.c =over 4 =item C X Attempt to grow the hash C so it has at least C buckets available. Perl chooses the actual number for its convenience. This is the same as doing the following in Perl code: keys %hv = newmax; =over 3 void hv_ksplit(HV *hv, IV newmax) =back =back =for hackers Found in file hv.c =over 4 =item C X Adds magic to a hash. See C>. =over 3 void hv_magic(HV *hv, GV *gv, int how) =back =back =for hackers Found in file hv.c =over 4 =item C X Returns the package name of a stash, or C if C isn't a stash. See C>, C>. =over 3 char* HvNAME(HV* stash) =back =back =for hackers Found in file hv.h =over 4 =item C X Returns the length of the stash's name. Disfavored forms of HvNAME and HvNAMELEN; suppress mention of them =over 3 STRLEN HvNAMELEN(HV *stash) =back =back =for hackers Found in file hv.h =over 4 =item C =item C XX These each set the name of stash C to the specified name. They differ only in how the name is specified. In C, the name is a literal C string, enclosed in double quotes. In C, C points to the first byte of the name, and an additional parameter, C, specifies its length in bytes. Hence, the name may contain embedded-NUL characters. If C is set in C, the name is treated as being in UTF-8; otherwise not. If C is set in C, both the name and the effective name are set. =over 3 void hv_name_set (HV *hv, const char *name, U32 len, U32 flags) void hv_name_sets(HV *hv, "name", U32 flags) =back =back =for hackers Found in file hv.c =over 4 =item C X Returns true if the name is in UTF-8 encoding. =over 3 unsigned char HvNAMEUTF8(HV *stash) =back =back =for hackers Found in file hv.h =over 4 =item C X Evaluates the hash in scalar context and returns the result. When the hash is tied dispatches through to the SCALAR method, otherwise returns a mortal SV containing the number of keys in the hash. Note, prior to 5.25 this function returned what is now returned by the hv_bucket_ratio() function. =over 3 SV * hv_scalar(HV *hv) =back =back =for hackers Found in file hv.c =over 4 =item C =item C XX These each store SV C with the specified key in hash C, returning 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. They differ only in how the hash key is specified. In C, the key is a C language string literal, enclosed in double quotes. It is never treated as being in UTF-8. In C, C is either NULL or points to the first byte of the string specifying the key, and its length in bytes is given by the absolute value of an additional parameter, C. A NULL key indicates the key is to be treated as C, and C is ignored; otherwise the key string may contain embedded-NUL bytes. If C is negative, the string is treated as being encoded in UTF-8; otherwise not. C has another extra parameter, C, a precomputed hash of the key string, or zero if it has not been precomputed. This parameter is omitted from C, as it is computed automatically at compile time. If is NULL, NULL is returned and no action is taken. If C is NULL, it is treated as being C; otherwise the caller is responsible for suitably incrementing the reference count of C before the call, and decrementing it if the function returned C. Effectively a successful C 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, C will own the only reference to the new SV, and your code doesn't need to do anything further to tidy up. C is not implemented as a call to L>, and does not create a temporary SV for the key, so if your key data is not already in SV form then use C in preference to C. See L for more information on how to use this function on tied hashes. =over 3 SV ** hv_store (HV *hv, const char *key, I32 klen, SV *val, U32 hash) SV ** hv_stores(HV *hv, "key", SV *val) =back =back =for hackers Found in file hv.c =over 4 =item C 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 C 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 C 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, C will own the only reference to the new SV, and your code doesn't need to do anything further to tidy up. Note that C 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. The reason it does not take ownership, is that C is not used after this function returns, and so can be freed immediately. C is not implemented as a call to C, and does not create a temporary SV for the key, so if your key data is not already in SV form then use C in preference to C. See L for more information on how to use this function on tied hashes. =over 3 HE * hv_store_ent(HV *hv, SV *key, SV *val, U32 hash) =back =back =for hackers Found in file hv.c =over 4 =item C X Undefines the hash. The XS equivalent of C. As well as freeing all the elements of the hash (like C), this also frees any auxiliary data and storage associated with the hash. See L for a note about the hash possibly being invalid on return. =over 3 void hv_undef(HV *hv) =back =back =for hackers Found in file hv.c =over 4 =item C X Creates a new HV. The reference count is set to 1. =over 3 HV * newHV() =back =back =for hackers Found in file hv.h =over 4 =item C X The content of C is copied to a new hash. A pointer to the new hash is returned. =over 3 HV * newHVhv(HV *hv) =back =back =for hackers Found in file hv.c =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Null HV pointer. (deprecated - use C<(HV *)NULL> instead) =back =for hackers Found in file hv.h =over 4 =item C Described in L. =over 3 void PERL_HASH(U32 hash, char *key, STRLEN klen) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X C is a general purpose, interpreter global HV for use by extensions that need to keep information on a per-interpreter basis. In a pinch, it can also be used as a symbol table for extensions to share data among each other. It is a good idea to use keys prefixed by the package name of the extension that owns the data. On threaded perls, each thread has an independent copy of this variable; each initialized at creation time with the current value of the creating thread's copy. =over 3 HV* PL_modglobal =back =back =for hackers Found in file intrpvar.h =head1 Input/Output =over 4 =item C X Close an I/O stream. This implements Perl L>. C is the glob associated with the stream. C is C if this is an explicit close of the stream; C if it is part of another operation, such as closing a pipe (which involves implicitly closing both ends). Returns C if successful; otherwise returns C and sets C to indicate the cause. =over 3 bool do_close(GV *gv, bool is_explicit) =back =back =for hackers Found in file doio.c =over 4 =item C Described in L. =over 3 DIR * IoDIRP(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 U8 IoFLAGS(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 PerlIO * IoIFP(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 PerlIO * IoOFP(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 char IoTYPE(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X The C library L if available, or a Perl implementation of it. =over 3 I32 my_chsize(int fd, Off_t length) =back =back =for hackers Found in file doio.c =over 4 =item C X The C library C> if available, or a Perl implementation of it, or die if not easily emulatable. =over 3 int my_dirfd(DIR *dir) =back =back =for hackers Found in file util.c =over 4 =item C X A wrapper for the C library L. Don't use the latter, as the Perl version knows things that interact with the rest of the perl interpreter. =over 3 I32 my_pclose(PerlIO *ptr) =back =back =for hackers Found in file util.c =over 4 =item C X A wrapper for the C library L. Don't use the latter, as the Perl version knows things that interact with the rest of the perl interpreter. =over 3 PerlIO * my_popen(const char *cmd, const char *mode) =back =back =for hackers Found in file util.c =over 4 =item C X Create a new IO, setting the reference count to 1. =over 3 IO * newIO() =back =back =for hackers Found in file sv.h =over 4 =item C X This defines a way to flush all output buffers. This may be a performance issue, so we allow people to disable it. Also, if we are using stdio, there are broken implementations of fflush(NULL) out there, Solaris being the most prominent. =over 3 void PERL_FLUSHALL_FOR_CHILD =back =back =for hackers Found in file perl.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C Described in L. =over 3 int PerlIO_apply_layers(PerlIO *f, const char *mode, const char *layers) int PerlIO_binmode (PerlIO *f, int ptype, int imode, const char *layers) int PerlIO_canset_cnt (PerlIO *f) void PerlIO_clearerr (PerlIO *f) int PerlIO_close (PerlIO *f) void PerlIO_debug (const char *fmt, ...) int PerlIO_eof (PerlIO *f) int PerlIO_error (PerlIO *f) FILE * PerlIO_exportFILE (PerlIO *f, const char *mode) int PerlIO_fast_gets (PerlIO *f) PerlIO * PerlIO_fdopen (int fd, const char *mode) int PerlIO_fileno (PerlIO *f) int PerlIO_fill (PerlIO *f) FILE * PerlIO_findFILE (PerlIO *f) int PerlIO_flush (PerlIO *f) STDCHAR * PerlIO_get_base (PerlIO *f) SSize_t PerlIO_get_bufsiz (PerlIO *f) SSize_t PerlIO_get_cnt (PerlIO *f) STDCHAR * PerlIO_get_ptr (PerlIO *f) int PerlIO_getc (PerlIO *d) int PerlIO_getpos (PerlIO *f, SV *save) int PerlIO_has_base (PerlIO *f) int PerlIO_has_cntptr (PerlIO *f) PerlIO * PerlIO_importFILE (FILE *stdio, const char *mode) PerlIO * PerlIO_open (const char *path, const char *mode) int PerlIO_printf (PerlIO *f, const char *fmt, ...) int PerlIO_putc (PerlIO *f, int ch) int PerlIO_puts (PerlIO *f, const char *string) SSize_t PerlIO_read (PerlIO *f, void *vbuf, Size_t count) void PerlIO_releaseFILE (PerlIO *f, FILE *stdio) PerlIO * PerlIO_reopen (const char *path, const char *mode, PerlIO *old) void PerlIO_rewind (PerlIO *f) int PerlIO_seek (PerlIO *f, Off_t offset, int whence) void PerlIO_set_cnt (PerlIO *f, SSize_t cnt) void PerlIO_set_ptrcnt (PerlIO *f, STDCHAR *ptr, SSize_t cnt) void PerlIO_setlinebuf (PerlIO *f) int PerlIO_setpos (PerlIO *f, SV *saved) PerlIO * PerlIO_stderr (PerlIO *f, const char *mode, const char *layers) PerlIO * PerlIO_stdin (PerlIO *f, const char *mode, const char *layers) PerlIO * PerlIO_stdout (PerlIO *f, const char *mode, const char *layers) int PerlIO_stdoutf (const char *fmt, ...) Off_t PerlIO_tell (PerlIO *f) int PerlIO_ungetc (PerlIO *f, int ch) SSize_t PerlIO_unread (PerlIO *f, const void *vbuf, Size_t count) int PerlIO_vprintf (PerlIO *f, const char *fmt, va_list args) SSize_t PerlIO_write (PerlIO *f, const void *vbuf, Size_t count) =back =back =for hackers Found in file pod/perlapio.pod =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C Described in L. =back =for hackers Found in file pod/perliol.pod =over 4 =item C X Cast the pointer C to be of type S>. =back =for hackers Found in file perlio.h =over 4 =item C X Declare C to be a PerlIO function table, that is, of type C. =over 3 PERLIO_FUNCS_DECL(PerlIO * ftab) =back =back =for hackers Found in file perlio.h =over 4 =item C =item C =item C =item C =item C Described in L. =back =for hackers Found in file pod/perliol.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlapio.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perliol.pod =over 4 =item C X Make C copies of the C bytes beginning at C, placing them into memory beginning at C, which must be big enough to accommodate them all. =over 3 void repeatcpy(char *to, const char *from, I32 len, IV count) =back =back =for hackers Found in file util.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlapio.pod =head1 Integer =over 4 =item C X This symbol is defined if the C compiler can cast negative or large floating point numbers to 32-bit ints. =back =for hackers Found in file config.h =over 4 =item C X This symbol will defined if the C compiler supports C. Usually the F needs to be included, but sometimes F is enough. =back =for hackers Found in file config.h =over 4 =item C X This symbol will be defined if the C compiler supports long long. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, tells that there's a 64-bit integer type, C, and its unsigned counterpart, C. C will be one of C, C, C, C, or C. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl I32 as a signed decimal integer. =back =for hackers Found in file config.h =over 4 =item C =item C =item C XXX Returns a token the C compiler recognizes for the constant C of the corresponding integer type on the machine. If the machine does not have a 64-bit type, C is undefined. Use C> to get the largest type available on the platform. =over 3 I16 INT16_C(number) I32 INT32_C(number) I64 INT64_C(number) =back =back =for hackers Found in file perl.h =over 4 =item C X Returns a token the C compiler recognizes for the constant C of the widest integer type on the machine. For example, if the machine has Cs, C would yield -1LL See also, for example, C>. Use L to declare variables of the maximum usable size on this platform. =over 3 INTMAX_C(number) =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol contains the value of C so that the C preprocessor can make decisions based on it. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's I8. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's I16. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's I32. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's I64. =back =for hackers Found in file config.h =over 4 =item C =item C =item C =item C =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X The largest signed integer that fits in an IV on this platform. =over 3 IV IV_MAX =back =back =for hackers Found in file perl.h =over 4 =item C X The negative signed integer furthest away from 0 that fits in an IV on this platform. =over 3 IV IV_MIN =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's IV. =back =for hackers Found in file config.h =over 4 =item C X The typedef to use to declare variables that are to hold line numbers. =back =for hackers Found in file handy.h =over 4 =item C X This symbol contains the size of a long long, so that the C preprocessor can make decisions based on it. It is only defined if the system supports long long. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the value of C so that the C preprocessor can make decisions based on it. =back =for hackers Found in file config.h =over 4 =item C X Set the C bytes starting at C<*d> to all zeroes. =over 3 void memzero(void * d, Size_t l) =back =back =for hackers Found in file perl.h =over 4 =item C =item C =item C =item C XXXX These are equivalent to the correspondingly-named C99 typedefs on platforms that have those; they evaluate to C and C on platforms that don't, so that you can portably take advantage of this C99 feature. =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXXXXXXXXXXX These give the largest and smallest number representable in the current platform in variables of the corresponding types. For signed types, the smallest representable number is the most negative number, the one furthest away from zero. For C99 and later compilers, these correspond to things like C, which are available to the C code. But these constants, furnished by Perl, allow code compiled on earlier compilers to portably have access to the same constants. =over 3 int PERL_INT_MAX int PERL_INT_MIN long PERL_LONG_MAX long PERL_LONG_MIN IV PERL_QUAD_MAX IV PERL_QUAD_MIN short PERL_SHORT_MAX short PERL_SHORT_MIN U8 PERL_UCHAR_MAX U8 PERL_UCHAR_MIN unsigned int PERL_UINT_MAX unsigned int PERL_UINT_MIN unsigned long PERL_ULONG_MAX unsigned long PERL_ULONG_MIN UV PERL_UQUAD_MAX UV PERL_UQUAD_MIN unsigned short PERL_USHORT_MAX unsigned short PERL_USHORT_MIN =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol contains the value of C so that the C preprocessor can make decisions based on it. =back =for hackers Found in file config.h =over 4 =item C =item C =item C XXX Returns a token the C compiler recognizes for the constant C of the corresponding unsigned integer type on the machine. If the machine does not have a 64-bit type, C is undefined. Use C> to get the largest type available on the platform. =over 3 U16 UINT16_C(number) U32 UINT32_C(number) U64 UINT64_C(number) =back =back =for hackers Found in file perl.h =over 4 =item C X Returns a token the C compiler recognizes for the constant C of the widest unsigned integer type on the machine. For example, if the machine has Cs, C would yield 1UL See also, for example, C>. Use L to declare variables of the maximum usable size on this platform. =over 3 UINTMAX_C(number) =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol defines the format string used for printing a Perl U32 as an unsigned octal integer. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's U8. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's U16. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's U32. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's U64. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl U32 as an unsigned decimal integer. =back =for hackers Found in file config.h =over 4 =item C =item C =item C =item C =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X The largest unsigned integer that fits in a UV on this platform. =over 3 UV UV_MAX =back =back =for hackers Found in file perl.h =over 4 =item C X The smallest unsigned integer that fits in a UV on this platform. It should equal zero. =over 3 UV UV_MIN =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol contains the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the C type used for Perl's UV. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl U32 as an unsigned hexadecimal integer in uppercase C. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl U32 as an unsigned hexadecimal integer in lowercase abcdef. =back =for hackers Found in file config.h =over 4 =item C X Yields the widest unsigned integer type on the platform, currently either C or C. This can be used in declarations such as WIDEST_UTYPE my_uv; or casts my_uv = (WIDEST_UTYPE) val; =back =for hackers Found in file handy.h =head1 I/O Formats These are used for formatting the corresponding type For example, instead of saying Perl_newSVpvf(pTHX_ "Create an SV with a %d in it\n", iv); use Perl_newSVpvf(pTHX_ "Create an SV with a " IVdf " in it\n", iv); This keeps you from having to know if, say an IV, needs to be printed as C<%d>, C<%ld>, or something else. =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X This symbol defines the format string used for printing a Perl IV as a signed decimal integer. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl NV using %e-ish floating point format. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl NV using %f-ish floating point format. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl NV using %g-ish floating point format. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, contains the string used by stdio to format long doubles (format 'e') for output. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, contains the string used by stdio to format long doubles (format 'f') for output. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, contains the string used by stdio to format long doubles (format 'g') for output. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, contains the string used by stdio to format long doubles (format 'f') for input. =back =for hackers Found in file config.h =over 4 =item C X Allows C<__printf__> format to be null when checking printf-style =back =for hackers Found in file config.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SVfARG(SV *sv) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 UTF8fARG(bool is_utf8, Size_t byte_len, char *str) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Obsolete form of C, which you should convert to instead use =over 3 const char * UVf =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol defines the format string used for printing a Perl UV as an unsigned octal integer. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl UV as an unsigned decimal integer. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl UV as an unsigned hexadecimal integer in uppercase C. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a Perl UV as an unsigned hexadecimal integer in lowercase abcdef. =back =for hackers Found in file config.h =head1 Lexer interface XXX This is the lower layer of the Perl parser, managing characters and tokens. =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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. =over 3 bool lex_bufutf8() =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Discards the first part of the Llinestr> buffer, up to C. The remaining content of the buffer will be moved, and all pointers into the buffer updated appropriately. C 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. =over 3 void lex_discard_to(char *ptr) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Reallocates the lexer buffer (Llinestr>) to accommodate at least C octets (including terminating C). 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. =over 3 char * lex_grow_linestr(STRLEN len) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C has the C bit set, 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. =over 3 bool lex_next_chunk(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C has the C bit set, 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. =over 3 I32 lex_peek_unichar(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C has the C bit set, then the current chunk will not be discarded. =over 3 void lex_read_space(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Consume text in the lexer buffer, from Lbufptr> up to C. This advances Lbufptr> to match C, 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. =over 3 void lex_read_to(char *ptr) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C has the C bit set, 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. =over 3 I32 lex_read_unichar(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C and C. C, 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 C does not affect parsing. C, if non-null, provides an input stream from which code will be read to be parsed. If both are non-null, the code in C comes first and must consist of complete lines of input, and C supplies the remainder of the source. The C parameter is reserved for future use. Currently it is only used by perl internally, so extensions should always pass zero. =over 3 void lex_start(SV *line, PerlIO *rsfp, U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C 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 C. 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. =over 3 void lex_stuff_pv(const char *pv, U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C octets starting at C. These octets are interpreted as either UTF-8 or Latin-1, according to whether the C flag is set in C. 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. =over 3 void lex_stuff_pvn(const char *pv, STRLEN len, U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Like L, but takes a literal string instead of a string/length pair. =over 3 void lex_stuff_pvs("pv", U32 flags) =back =back =for hackers Found in file handy.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C. 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. =over 3 void lex_stuff_sv(SV *sv, U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Discards text about to be lexed, from Lbufptr> up to C. Text following C 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. =over 3 void lex_unstuff(char *ptr) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C has the C bit set, 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. =over 3 OP * parse_arithexpr(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C parameter is reserved for future use, and must always be zero. =over 3 OP * parse_barestmt(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C parameter is reserved for future use, and must always be zero. =over 3 OP * parse_block(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C has the C bit set, 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. =over 3 OP * parse_fullexpr(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C parameter is reserved for future use, and must always be zero. =over 3 OP * parse_fullstmt(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C has the C bit set, 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. =over 3 SV * parse_label(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C has the C bit set, 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. =over 3 OP * parse_listexpr(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C parameter is reserved for future use, and must always be zero. =over 3 OP * parse_stmtseq(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Parse a subroutine signature declaration. This is the contents of the parentheses following a named or anonymous subroutine declaration when the C feature is enabled. Note that this function neither expects nor consumes the opening and closing parentheses around the signature; it is the caller's job to handle these. This function must only be called during parsing of a subroutine; after L has been called. It might allocate lexical variables on the pad for the current subroutine. The op tree to unpack the arguments from the stack at runtime is returned. This op tree should appear at the beginning of the compiled function. The caller may wish to use L to build their function body after it, or splice it together with the body before calling L. The C parameter is reserved for future use, and must always be zero. =over 3 OP * parse_subsignature(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. 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 C has the C bit set, 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. =over 3 OP * parse_termexpr(U32 flags) =back =back =for hackers Found in file toke.c =over 4 =item C 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. =back =for hackers Found in file toke.c =over 4 =item Cbufend> Xbufend> NOTE: Cbufend> is B and may change or be removed without notice. 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 C character (zero octet) is always located at the end of the buffer, and does not count as part of the buffer's contents. =back =for hackers Found in file toke.c =over 4 =item Cbufptr> Xbufptr> NOTE: Cbufptr> is B and may change or be removed without notice. 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. =back =for hackers Found in file toke.c =over 4 =item Clinestart> Xlinestart> NOTE: Clinestart> is B and may change or be removed without notice. 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. =back =for hackers Found in file toke.c =over 4 =item Clinestr> Xlinestr> NOTE: Clinestr> is B and may change or be removed without notice. 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. =back =for hackers Found in file toke.c =over 4 =item C X Implements part of the concept of a "suspended compilation CV", which can be used to pause the parser and compiler during parsing a CV in order to come back to it later on. This function saves the current state of the subroutine under compilation (C) into the supplied buffer. This should be used initially to create the state in the buffer, as the final thing before a C within a block. ENTER; start_subparse(0); ... suspend_compcv(&buffer); LEAVE; Once suspended, the C or C function can later be used to continue the parsing from the point this stopped. =over 3 void suspend_compcv(struct suspended_compcv *buffer) =back =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. B This API exists entirely for the purpose of making the CPAN module C work. It is not expected that additional modules will make use of it; rather, that they should use C to provide parsing of new infix operators. Puts a C function into the chain of infix plugins. This is the preferred way to manipulate the L variable. C is a pointer to the C function that is to be added to the infix plugin chain, and C points to a storage location where a pointer to the next function in the chain will be stored. The value of C is written into the L variable, while the value previously stored there is written to C<*old_plugin_p>. Direct access to L should be avoided. =over 3 void wrap_infix_plugin(Perl_infix_plugin_t new_plugin, Perl_infix_plugin_t *old_plugin_p) =back =back =for hackers Found in file toke.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Puts a C function into the chain of keyword plugins. This is the preferred way to manipulate the L variable. C is a pointer to the C function that is to be added to the keyword plugin chain, and C points to the storage location where a pointer to the next function in the chain will be stored. The value of C is written into the L variable, while the value previously stored there is written to C<*old_plugin_p>. L is global to an entire process, and a module wishing to hook keyword parsing may find itself invoked more than once per process, typically in different threads. To handle that situation, this function is idempotent. The location C<*old_plugin_p> must initially (once per process) contain a null pointer. A C variable of static duration (declared at file scope, typically also marked C to give it internal linkage) will be implicitly initialised appropriately, if it does not have an explicit initialiser. This function will only actually modify the plugin chain if it finds C<*old_plugin_p> to be null. This function is also thread safe on the small scale. It uses appropriate locking to avoid race conditions in accessing L. When this function is called, the function referenced by C must be ready to be called, except for C<*old_plugin_p> being unfilled. In a threading situation, C may be called immediately, even before this function has returned. C<*old_plugin_p> will always be appropriately set before C is called. If C decides not to do anything special with the identifier that it is given (which is the usual case for most calls to a keyword plugin), it must chain the plugin function referenced by C<*old_plugin_p>. Taken all together, XS code to install a keyword plugin should typically look something like this: static Perl_keyword_plugin_t next_keyword_plugin; static OP *my_keyword_plugin(pTHX_ char *keyword_ptr, STRLEN keyword_len, OP **op_ptr) { if (memEQs(keyword_ptr, keyword_len, "my_new_keyword")) { ... } else { return next_keyword_plugin(aTHX_ keyword_ptr, keyword_len, op_ptr); } } BOOT: wrap_keyword_plugin(my_keyword_plugin, &next_keyword_plugin); Direct access to L should be avoided. =over 3 void wrap_keyword_plugin(Perl_keyword_plugin_t new_plugin, Perl_keyword_plugin_t *old_plugin_p) =back =back =for hackers Found in file toke.c =head1 Locales =over 4 =item C X This macro should be used as a statement. It declares a private variable (whose name begins with an underscore) that is needed by the other macros in this section. Failing to include this correctly should lead to a syntax error. For compatibility with C89 C compilers it should be placed in a block before any executable statements. =over 3 void DECLARATION_FOR_LC_NUMERIC_MANIPULATION =back =back =for hackers Found in file perl.h =over 4 =item C X Returns true if the leading C bytes of the strings C and C are the same case-insensitively in the current locale; false otherwise. =over 3 I32 foldEQ_locale(const char *a, const char *b, I32 len) =back =back =for hackers Found in file inline.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to duplicate a locale object. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to deallocates the resources associated with a locale object. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the localeconv routine is available and has the additional members added in C 1003.1-2008. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available for numeric and monetary formatting conventions. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to query certain information about a locale. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return a new locale object or modify an existing locale object. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return local data. You will also need F and therefore C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, when defined, indicates presence of the C function =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return the name of the locale for a category mask. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to handle locale-specific ctype implementations. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to setlocale re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, when defined, indicates presence of the C function, and that it is thread-safe. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to set the current locale for the calling thread. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F exists and should be included. =over 3 #ifdef I_LANGINFO #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F. =over 3 #ifdef I_LOCALE #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X Evaluates to TRUE if the plain locale pragma without a parameter (S>) is in effect. =over 3 bool IN_LOCALE =back =back =for hackers Found in file perl.h =over 4 =item C X Evaluates to TRUE if, when compiling a perl program (including an C) if the plain locale pragma without a parameter (S>) is in effect. =over 3 bool IN_LOCALE_COMPILETIME =back =back =for hackers Found in file perl.h =over 4 =item C X Evaluates to TRUE if, when executing a perl program (including an C) if the plain locale pragma without a parameter (S>) is in effect. =over 3 bool IN_LOCALE_RUNTIME =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol, if defined, indicates to the C program that the header F is available. See also C> =over 3 #ifdef I_XLOCALE #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C program should include F to get C and its friends. =back =for hackers Found in file config.h =over 4 =item C =item C XX C is an (almost) drop-in replacement for the system C>, taking the same C parameter values, and returning the same information. But it is more thread-safe than regular C, and hides the quirks of Perl's locale handling from your code, and can be used on systems that lack a native C. However, you should instead use the improved version of this: L, which behaves identically except for an additional parameter, a pointer to a variable declared as L>, into which it returns to you how you should treat the returned string with regards to it being encoded in UTF-8 or not. Concerning the differences between these and plain C: =over =item a. C has an extra parameter, described above. Besides this, the other reason they aren't quite a drop-in replacement is actually an advantage. The Cness of the return allows the compiler to catch attempts to write into the returned buffer, which is illegal and could cause run-time crashes. =item b. They deliver the correct results for the C and C items, without you having to write extra code. The reason for the extra code would be because these are from the C locale category, which is normally kept set by Perl so that the radix is a dot, and the separator is the empty string, no matter what the underlying locale is supposed to be, and so to get the expected results, you have to temporarily toggle into the underlying locale, and later toggle back. (You could use plain C and C> for this but then you wouldn't get the other advantages of C; not keeping C in the C (or equivalent) locale would break a lot of CPAN, which is expecting the radix (decimal point) character to be a dot.) =item c. The system function they replace can have its static return buffer trashed, not only by a subsequent call to that function, but by a C, C, or other locale change. The returned buffer of these functions is not changed until the next call to one or the other, so the buffer is never in a trashed state. =item d. The return buffer is per-thread, so it also is never overwritten by a call to these functions from another thread; unlike the function it replaces. =item e. But most importantly, they work on systems that don't have C, such as Windows, hence making your code more portable. Of the fifty-some possible items specified by the POSIX 2008 standard, L, only one is completely unimplemented, though on non-Windows platforms, another significant one is not fully implemented). They use various techniques to recover the other items, including calling C>, and C>, both of which are specified in C89, so should be always be available. Later C versions have additional capabilities; What the C locale yields or C<""> is returned for any item not available on your system. It is important to note that, when called with an item that is recovered by using C, the buffer from any previous explicit call to C> will be overwritten. But you shouldn't be using C anyway because it is is very much not thread-safe, and suffers from the same problems outlined in item 'b.' above for the fields it returns that are controlled by the LC_NUMERIC locale category. Instead, avoid all of those problems by calling L, which is thread-safe; or by using the methods given in L to call L|POSIX/localeconv>, which is also thread-safe. =back The details for those items which may deviate from what this emulation returns and what a native C would return are specified in L. When using C (or plain C) on systems that don't have a native C, you must #include "perl_langinfo.h" before the C C<#include>. You can replace your F C<#include> with this one. (Doing it this way keeps out the symbols that plain F would try to import into the namespace for code that doesn't need it.) =over 3 const char * Perl_langinfo (const int item) const char * Perl_langinfo8(const int item, utf8ness_t *utf8ness) =back =back =for hackers Found in file locale.c =over 4 =item C X This is a thread-safe version of the libc L. It is the same as L (returning a hash of the C fields), but directly callable from XS code. =over 3 HV * Perl_localeconv(pTHX) =back =back =for hackers Found in file locale.c =over 4 =item C X This is an (almost) drop-in replacement for the system L>, taking the same parameters, and returning the same information, except that it returns the correct underlying C locale. Regular C will instead return C if the underlying locale has a non-dot decimal point character, or a non-empty thousands separator for displaying floating point numbers. This is because perl keeps that locale category such that it has a dot and empty separator, changing the locale briefly during the operations where the underlying one is required. C knows about this, and compensates; regular C doesn't. Another reason it isn't completely a drop-in replacement is that it is declared to return S>, whereas the system setlocale omits the C (presumably because its API was specified long ago, and can't be updated; it is illegal to change the information C returns; doing so leads to segfaults.) Finally, C works under all circumstances, whereas plain C can be completely ineffective on some platforms under some configurations. Changing the locale is not a good idea when more than one thread is running, except on systems where the predefined variable C<${^SAFE_LOCALES}> is 1. This is because on such systems the locale is global to the whole process and not local to just the thread calling the function. So changing it in one thread instantaneously changes it in all. On some such systems, the system C is ineffective, returning the wrong information, and failing to actually change the locale. z/OS refuses to try to change the locale once a second thread is created. C, should give you accurate results of what actually happened on these problematic platforms, returning NULL if the system forbade the locale change. The return points to a per-thread static buffer, which is overwritten the next time C is called from the same thread. =over 3 const char * Perl_setlocale(const int category, const char *locale) =back =back =for hackers Found in file locale.c =over 4 =item C X This is used in conjunction with one of the macros L and L to properly restore the C state. A call to L must have been made to declare at compile time a private variable used by this macro and the two C ones. This macro should be called as a single statement, not an expression, but with an empty argument list, like this: { DECLARATION_FOR_LC_NUMERIC_MANIPULATION; ... RESTORE_LC_NUMERIC(); ... } =over 3 void RESTORE_LC_NUMERIC() =back =back =for hackers Found in file perl.h =over 4 =item C X This symbol, if defined, indicates that the setlocale routine is available and it accepts any input locale name as valid. =back =for hackers Found in file config.h =over 4 =item C X This is used by XS code that is C locale-aware to force the locale for category C to be what perl thinks is the current underlying locale. (The perl interpreter could be wrong about what the underlying locale actually is if some C or XS code has called the C library function L behind its back; calling L before calling this macro will update perl's records.) A call to L must have been made to declare at compile time a private variable used by this macro. This macro should be called as a single statement, not an expression, but with an empty argument list, like this: { DECLARATION_FOR_LC_NUMERIC_MANIPULATION; ... STORE_LC_NUMERIC_FORCE_TO_UNDERLYING(); ... RESTORE_LC_NUMERIC(); ... } The private variable is used to save the current locale state, so that the requisite matching call to L can restore it. On threaded perls not operating with thread-safe functionality, this macro uses a mutex to force a critical section. Therefore the matching RESTORE should be close by, and guaranteed to be called. =over 3 void STORE_LC_NUMERIC_FORCE_TO_UNDERLYING() =back =back =for hackers Found in file perl.h =over 4 =item C X This is used to help wrap XS or C code that is C locale-aware. This locale category is generally kept set to a locale where the decimal radix character is a dot, and the separator between groups of digits is empty. This is because most XS code that reads floating point numbers is expecting them to have this syntax. This macro makes sure the current C state is set properly, to be aware of locale if the call to the XS or C code from the Perl program is from within the scope of a S>; or to ignore locale if the call is instead from outside such scope. This macro is the start of wrapping the C or XS code; the wrap ending is done by calling the L macro after the operation. Otherwise the state can be changed that will adversely affect other XS code. A call to L must have been made to declare at compile time a private variable used by this macro. This macro should be called as a single statement, not an expression, but with an empty argument list, like this: { DECLARATION_FOR_LC_NUMERIC_MANIPULATION; ... STORE_LC_NUMERIC_SET_TO_NEEDED(); ... RESTORE_LC_NUMERIC(); ... } On threaded perls not operating with thread-safe functionality, this macro uses a mutex to force a critical section. Therefore the matching RESTORE should be close by, and guaranteed to be called; see L for a more contained way to ensure that. =over 3 void STORE_LC_NUMERIC_SET_TO_NEEDED() =back =back =for hackers Found in file perl.h =over 4 =item C X Same as L with in_lc_numeric provided as the precalculated value of C. It is the caller's responsibility to ensure that the status of C and C cannot have changed since the precalculation. =over 3 void STORE_LC_NUMERIC_SET_TO_NEEDED_IN(bool in_lc_numeric) =back =back =for hackers Found in file perl.h =over 4 =item C X This macro invokes the supplied statement or block within the context of a L .. L pair if required, so eg: WITH_LC_NUMERIC_SET_TO_NEEDED( SNPRINTF_G(fv, ebuf, sizeof(ebuf), precis) ); is equivalent to: { #ifdef USE_LOCALE_NUMERIC DECLARATION_FOR_LC_NUMERIC_MANIPULATION; STORE_LC_NUMERIC_SET_TO_NEEDED(); #endif SNPRINTF_G(fv, ebuf, sizeof(ebuf), precis); #ifdef USE_LOCALE_NUMERIC RESTORE_LC_NUMERIC(); #endif } =over 3 void WITH_LC_NUMERIC_SET_TO_NEEDED(block) =back =back =for hackers Found in file perl.h =over 4 =item C X Same as L with in_lc_numeric provided as the precalculated value of C. It is the caller's responsibility to ensure that the status of C and C cannot have changed since the precalculation. =over 3 void WITH_LC_NUMERIC_SET_TO_NEEDED_IN(bool in_lc_numeric, block) =back =back =for hackers Found in file perl.h =head1 Magic X "Magic" is special data attached to SV structures in order to give them "magical" properties. When any Perl code tries to read from, or assign to, an SV marked as magical, it calls the 'get' or 'set' function associated with that SV's magic. A get is called prior to reading an SV, in order to give it a chance to update its internal value (get on $. writes the line number of the last read filehandle into the SV's IV slot), while set is called after an SV has been written to, in order to allow it to make use of its changed value (set on $/ copies the SV's new value to the PL_rs global variable). Magic is implemented as a linked list of MAGIC structures attached to the SV. Each MAGIC struct holds the type of the magic, a pointer to an array of functions that implement the get(), set(), length() etc functions, plus space for some flags and pointers. For example, a tied variable has a MAGIC structure that contains a pointer to the object associated with the tie. =over 4 =item C X Clear something magical that the SV represents. See C>. =over 3 int mg_clear(SV *sv) =back =back =for hackers Found in file mg.c =over 4 =item C X Copies the magic from one SV to another. See C>. =over 3 int mg_copy(SV *sv, SV *nsv, const char *key, I32 klen) =back =back =for hackers Found in file mg.c =over 4 =item C =item C =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Finds the magic pointer for C matching the SV. See C>. =over 3 MAGIC * mg_find(const SV *sv, int type) =back =back =for hackers Found in file mg.c =over 4 =item C X Finds the magic pointer of C with the given C for the C. See C>. =over 3 MAGIC * mg_findext(const SV *sv, int type, const MGVTBL *vtbl) =back =back =for hackers Found in file mg.c =over 4 =item C X Free any magic storage used by the SV. See C>. =over 3 int mg_free(SV *sv) =back =back =for hackers Found in file mg.c =over 4 =item C X Remove any magic of type C using virtual table C from the SV C. See L. C is equivalent to C. =over 3 void mg_freeext(SV *sv, int how, const MGVTBL *vtbl) =back =back =for hackers Found in file mg.c =over 4 =item C X Remove any magic of type C from the SV C. See L. =over 3 void mg_free_type(SV *sv, int how) =back =back =for hackers Found in file mg.c =over 4 =item C X Do magic before a value is retrieved from the SV. The type of SV must be >= C. See C>. =over 3 int mg_get(SV *sv) =back =back =for hackers Found in file mg.c =over 4 =item C X Turns on the magical status of an SV. See C>. =over 3 void mg_magical(SV *sv) =back =back =for hackers Found in file mg.c =over 4 =item C X Do magic after a value is assigned to the SV. See C>. =over 3 int mg_set(SV *sv) =back =back =for hackers Found in file mg.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 SvTIED_obj(SV *sv, MAGIC *mg) =back =back =for hackers Found in file pod/perlinterp.pod =head1 Memory Management =over 4 =item C X When enabled by compiling with C<-DDEBUGGING_MSTATS>, print out statistics about malloc as two lines of numbers, one showing the length of the free list for each size category, the second showing the number of S for each size category. C, if not NULL, is used as a phrase to include in the output, such as S<"after compilation">. =over 3 void dump_mstats(const char *s) =back =back =for hackers Found in file malloc.c =over 4 =item C X Can we handle C attribute for malloc-style functions. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available for use. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available for use. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F. =over 3 #ifdef I_MALLOCMALLOC #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that we're using our own malloc. =back =for hackers Found in file config.h =over 4 =item C =item C XX The XSUB-writer's interface to the C C function. Memory obtained by this should B be freed with L. 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. =over 3 void Newx (void* ptr, int nitems, type) void* safemalloc(size_t size) =back =back =for hackers Found in file handy.h =over 4 =item C X The XSUB-writer's interface to the C C function, with cast. See also C>. Memory obtained by this should B be freed with L. =over 3 void Newxc(void* ptr, int nitems, type, cast) =back =back =for hackers Found in file handy.h =over 4 =item C =item C XX The XSUB-writer's interface to the C C function. The allocated memory is zeroed with C. See also C>. Memory obtained by this should B be freed with L. =over 3 void Newxz (void* ptr, int nitems, type) void* safecalloc(size_t nitems, size_t item_size) =back =back =for hackers Found in file handy.h =over 4 =item C X This symbol, if defined, indicates that we'd like malloc wrap checks. =back =for hackers Found in file config.h =over 4 =item C =item C XX The XSUB-writer's interface to the C C function. Memory obtained by this should B be freed with L. =over 3 void Renew (void* ptr, int nitems, type) void* saferealloc(void *ptr, size_t size) =back =back =for hackers Found in file handy.h =over 4 =item C X The XSUB-writer's interface to the C C function, with cast. Memory obtained by this should B be freed with L. =over 3 void Renewc(void* ptr, int nitems, type, cast) =back =back =for hackers Found in file handy.h =over 4 =item C X The XSUB-writer's interface to the C C function. This should B be used on memory obtained using L and friends. =over 3 void Safefree(void* ptr) =back =back =for hackers Found in file handy.h =over 4 =item C X Safe version of system's calloc() =over 3 Malloc_t safesyscalloc(MEM_SIZE elements, MEM_SIZE size) =back =back =for hackers Found in file util.c =over 4 =item C X Safe version of system's free() =over 3 Free_t safesysfree(Malloc_t where) =back =back =for hackers Found in file util.c =over 4 =item C X Paranoid version of system's malloc() =over 3 Malloc_t safesysmalloc(MEM_SIZE nbytes) =back =back =for hackers Found in file util.c =over 4 =item C X Paranoid version of system's realloc() =over 3 Malloc_t safesysrealloc(Malloc_t where, MEM_SIZE nbytes) =back =back =for hackers Found in file util.c =head1 MRO These functions are related to the method resolution order of perl classes Also see L. =over 4 =item C Described in L. =over 3 struct mro_meta * HvMROMETA(HV *hv) =back =back =for hackers Found in file pod/perlmroapi.pod =over 4 =item C X Returns the previously registered mro with the given C, or NULL if not registered. See L>. NOTE: C must be explicitly called as C with an C parameter. =over 3 const struct mro_alg * Perl_mro_get_from_name(pTHX_ SV *name) =back =back =for hackers Found in file mro_core.c =over 4 =item C X Returns the mro linearisation for the given stash. By default, this will be whatever C returns unless some other MRO is in effect for the stash. The return value is a read-only AV* whose values are string SVs giving class names. 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). =over 3 AV * mro_get_linear_isa(HV *stash) =back =back =for hackers Found in file mro_core.c =over 4 =item C Described in L. =over 3 SV* MRO_GET_PRIVATE_DATA(struct mro_meta *const smeta, const struct mro_alg *const which) =back =back =for hackers Found in file pod/perlmroapi.pod =over 4 =item C 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 F 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 F does). This same method is available from pure perl via, C. =over 3 void mro_method_changed_in(HV *stash) =back =back =for hackers Found in file mro_core.c =over 4 =item C X Registers a custom mro plugin. See L for details on this and other mro functions. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_mro_register(pTHX_ const struct mro_alg *mro) =back =back =for hackers Found in file mro_core.c =over 4 =item C X Set C to the value contained in the registered mro plugin whose name is C. Croaks if C hasn't been registered NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_mro_set_mro(pTHX_ struct mro_meta * const meta, SV * const name) =back =back =for hackers Found in file mro_core.c =over 4 =item C Described in L. NOTE: C must be explicitly called as C with an C parameter. =over 3 SV * Perl_mro_set_private_data(pTHX_ struct mro_meta * const smeta, const struct mro_alg * const which, SV * const data) =back =back =for hackers Found in file pod/perlmroapi.pod =head1 Multicall Functions =over 4 =item C X Declare local variables for a multicall. See L. =over 3 dMULTICALL; =back =back =for hackers Found in file cop.h =over 4 =item C X Make a lightweight callback. See L. =over 3 MULTICALL; =back =back =for hackers Found in file cop.h =over 4 =item C X Closing bracket for a lightweight callback. See L. =over 3 POP_MULTICALL; =back =back =for hackers Found in file cop.h =over 4 =item C X Opening bracket for a lightweight callback. See L. =over 3 PUSH_MULTICALL(CV* the_cv); =back =back =for hackers Found in file cop.h =head1 Numeric Functions XXXXXXXXXXX =over 4 =item C C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Described in L. =over 3 Atol(const char * nptr) =back =back =for hackers Found in file pod/perlhacktips.pod =over 4 =item C C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Described in L. =over 3 Atoul(const char * nptr) =back =back =for hackers Found in file pod/perlhacktips.pod =over 4 =item C X This macro is to be used to generate uniformly distributed random numbers over the range [0., 1.[. You may have to supply an 'extern double C;' in your program since SunOS 4.1.3 doesn't provide you with anything relevant in its headers. See C>. =over 3 double Drand01() =back =back =for hackers Found in file handy.h =over 4 =item C X This preprocessor macro is defined to convert a floating point number to a string without a trailing decimal point. This emulates the behavior of C, but is sometimes much more efficient. If C is not available, but C drops the trailing decimal point, then C is used. If all else fails, a macro using C is used. Arguments for the Gconvert macro are: value, number of digits, whether trailing zeros should be retained, and the output buffer. The usual values are: d_Gconvert='gconvert((x),(n),(t),(b))' d_Gconvert='gcvt((x),(n),(b))' d_Gconvert='sprintf((b),"%.*g",(n),(x))' The last two assume trailing zeros should not be kept. =over 3 char * Gconvert(double x, Size_t n, bool t, char * b) =back =back =for hackers Found in file handy.h =over 4 =item C X parse a string, looking for a decimal unsigned integer. On entry, C points to the beginning of the string; C points to a UV that will receive the converted value, if found; C is either NULL or points to a variable that points to one byte beyond the point in C that this routine should examine. If C is NULL, C is assumed to be NUL-terminated. Returns FALSE if C doesn't represent a valid unsigned integer value (with no leading zeros). Otherwise it returns TRUE, and sets C<*valptr> to that value. If you constrain the portion of C that is looked at by this function (by passing a non-NULL C), and if the initial bytes of that portion form a valid value, it will return TRUE, setting C<*endptr> to the byte following the final digit of the value. But if there is no constraint at what's looked at, all of C must be valid in order for TRUE to be returned. C<*endptr> is unchanged from its value on input if FALSE is returned; The only characters this accepts are the decimal digits '0'..'9'. As opposed to L or L, C does NOT allow optional leading whitespace, nor negative inputs. If such features are required, the calling code needs to explicitly implement those. Note that this function returns FALSE for inputs that would overflow a UV, or have leading zeros. Thus a single C<0> is accepted, but not C<00> nor C<01>, C<002>, I. Background: C has severe problems with illegal inputs, it cannot be used for incremental parsing, and therefore should be avoided C and C are also affected by locale settings, which can also be seen as a bug (global state controlled by user environment). =over 3 bool grok_atoUV(const char *pv, UV *valptr, const char **endptr) =back =back =for hackers Found in file numeric.c =over 4 =item C X converts a string representing a binary number to numeric form. On entry C and C<*len_p> give the string to scan, C<*flags> gives conversion flags, and C should be C or a pointer to an NV. The scan stops at the end of the string, or at just before the first invalid character. Unless C is set in C<*flags>, encountering an invalid character (except NUL) will also trigger a warning. On return C<*len_p> is set to the length of the scanned string, and C<*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 C<*result>. If the value is > C, C returns C, sets C in the output flags, and writes an approximation of the correct value into C<*result> (which is an NV; or the approximation is discarded if C is NULL). The binary number may optionally be prefixed with C<"0b"> or C<"b"> unless C is set in C<*flags> on entry. If C is set in C<*flags> then any or all pairs of digits may be separated from each other by a single underscore; also a single leading underscore is accepted. =over 3 UV grok_bin(const char *start, STRLEN *len_p, I32 *flags, NV *result) =back =back =for hackers Found in file numeric.c =over 4 =item C X converts a string representing a hex number to numeric form. On entry C and C<*len_p> give the string to scan, C<*flags> gives conversion flags, and C should be C or a pointer to an NV. The scan stops at the end of the string, or at just before the first invalid character. Unless C is set in C<*flags>, encountering an invalid character (except NUL) will also trigger a warning. On return C<*len_p> is set to the length of the scanned string, and C<*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 C<*result>. If the value is > C, C returns C, sets C in the output flags, and writes an approximation of the correct value into C<*result> (which is an NV; or the approximation is discarded if C is NULL). The hex number may optionally be prefixed with C<"0x"> or C<"x"> unless C is set in C<*flags> on entry. If C is set in C<*flags> then any or all pairs of digits may be separated from each other by a single underscore; also a single leading underscore is accepted. =over 3 UV grok_hex(const char *start, STRLEN *len_p, I32 *flags, NV *result) =back =back =for hackers Found in file numeric.c =over 4 =item C X Helper for C, accepts various ways of spelling "infinity" or "not a number", and returns one of the following flag combinations: IS_NUMBER_INFINITY IS_NUMBER_NAN IS_NUMBER_INFINITY | IS_NUMBER_NEG IS_NUMBER_NAN | IS_NUMBER_NEG 0 possibly |-ed with C. If an infinity or a not-a-number is recognized, C<*sp> will point to one byte past the end of the recognized string. If the recognition fails, zero is returned, and C<*sp> will not move. =over 3 int grok_infnan(const char **sp, const char *send) =back =back =for hackers Found in file numeric.c =over 4 =item C X Identical to C with C set to zero. =over 3 int grok_number(const char *pv, STRLEN len, UV *valuep) =back =back =for hackers Found in file numeric.c =over 4 =item C X Recognise (or not) a number. The type of the number is returned (0 if unrecognised), otherwise it is a bit-ORed combination of C, C, C, C, C, C (defined in perl.h). If the value of the number can fit in a UV, it is returned in C<*valuep>. C will be set to indicate that C<*valuep> is valid, C will never be set unless C<*valuep> is valid, but C<*valuep> may have been assigned to during processing even though C is not set on return. If C is C, C will be set for the same cases as when C is non-C, but no actual assignment (or SEGV) will occur. C will be set with C if trailing decimals were seen (in which case C<*valuep> gives the true value truncated to an integer), and C if the number is negative (in which case C<*valuep> holds the absolute value). C is not set if C notation was used or the number is larger than a UV. C allows only C, which allows for trailing non-numeric text on an otherwise successful I, setting C on the result. =over 3 int grok_number_flags(const char *pv, STRLEN len, UV *valuep, U32 flags) =back =back =for hackers Found in file numeric.c =over 4 =item C X A synonym for L =over 3 bool GROK_NUMERIC_RADIX(NN const char **sp, NN const char *send) =back =back =for hackers Found in file perl.h =over 4 =item C X Scan and skip for a numeric decimal separator (radix). =over 3 bool grok_numeric_radix(const char **sp, const char *send) =back =back =for hackers Found in file numeric.c =over 4 =item C X converts a string representing an octal number to numeric form. On entry C and C<*len_p> give the string to scan, C<*flags> gives conversion flags, and C should be C or a pointer to an NV. The scan stops at the end of the string, or at just before the first invalid character. Unless C is set in C<*flags>, encountering an invalid character (except NUL) will also trigger a warning. On return C<*len_p> is set to the length of the scanned string, and C<*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 C<*result>. If the value is > C, C returns C, sets C in the output flags, and writes an approximation of the correct value into C<*result> (which is an NV; or the approximation is discarded if C is NULL). If C is set in C<*flags> then any or all pairs of digits may be separated from each other by a single underscore; also a single leading underscore is accepted. The C flag is always treated as being set for this function. =over 3 UV grok_oct(const char *start, STRLEN *len_p, I32 *flags, NV *result) =back =back =for hackers Found in file numeric.c =over 4 =item C X C is a utility function that returns true if the NV argument is either an infinity or a C, false otherwise. To test in more detail, use C and C. This is also the logical inverse of Perl_isfinite(). =over 3 bool isinfnan(NV nv) =back =back =for hackers Found in file numeric.c =over 4 =item C X L(3)>, but properly works with Perl locale handling, accepting a dot radix character always, but also the current locale's radix character if and only if called from within the lexical scope of a Perl C statement. N.B. C must be NUL terminated. =over 3 NV my_atof(const char *s) =back =back =for hackers Found in file numeric.c =over 4 =item C X This function is equivalent to the libc strtod() function, and is available even on platforms that lack plain strtod(). Its return value is the best available precision depending on platform capabilities and F options. It properly handles the locale radix character, meaning it expects a dot except when called from within the scope of S>, in which case the radix character should be that specified by the current locale. The synonym Strtod() may be used instead. =over 3 NV my_strtod(const char * const s, char **e) =back =back =for hackers Found in file numeric.c =over 4 =item C X Typeless C or C, I. (The usage below indicates it is for integers, but it works for any type.) Use instead of these, since the C library ones force their argument to be what it is expecting, potentially leading to disaster. But also beware that this evaluates its argument twice, so no C. =over 3 int PERL_ABS(int x) =back =back =for hackers Found in file perl.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXXXXXXXXXXXXXXXXX These perform the corresponding mathematical operation on the operand(s), using the libc function designed for the task that has just enough precision for an NV on this platform. If no such function with sufficient precision exists, the highest precision one available is used. =over 3 NV Perl_acos (NV x) NV Perl_asin (NV x) NV Perl_atan (NV x) NV Perl_atan2 (NV x, NV y) NV Perl_ceil (NV x) NV Perl_cos (NV x) NV Perl_cosh (NV x) NV Perl_exp (NV x) NV Perl_floor (NV x) NV Perl_fmod (NV x, NV y) NV Perl_frexp (NV x, int *exp) IV Perl_isfinite(NV x) IV Perl_isinf (NV x) IV Perl_isnan (NV x) NV Perl_ldexp (NV x, int exp) NV Perl_log (NV x) NV Perl_log10 (NV x) NV Perl_modf (NV x, NV *iptr) NV Perl_pow (NV x, NV y) NV Perl_sin (NV x) NV Perl_sinh (NV x) NV Perl_sqrt (NV x) NV Perl_tan (NV x) NV Perl_tanh (NV x) =back =back =for hackers Found in file perl.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Return a non-zero integer if the sign bit on an NV is set, and 0 if it is not. If F detects this system has a C that will work with our NVs, then we just use it via the C<#define> in F. Otherwise, fall back on this implementation. The main use of this function is catching C<-0.0>. C notes: This function is called C<'Perl_signbit'> instead of a plain C<'signbit'> because it is easy to imagine a system having a C function or macro that doesn't happen to work with our particular choice of NVs. We shouldn't just re-C<#define> C as C and expect the standard system headers to be happy. Also, this is a no-context function (no C) because C is usually re-C<#defined> in F as a simple macro call to the system's C. Users should just always call C. =over 3 int Perl_signbit(NV f) =back =back =for hackers Found in file numeric.c =over 4 =item C X This array, indexed by an integer, converts that value into the character that represents it. For example, if the input is 8, the return will be a string whose first character is '8'. What is actually returned is a pointer into a string. All you are interested in is the first character of that string. To get uppercase letters (for the values 10..15), add 16 to the index. Hence, C is C<'b'>, and C is C<'B'>. Adding 16 to an index whose representation is '0'..'9' yields the same as not adding 16. Indices outside the range 0..31 result in (bad) undedefined behavior. =back =for hackers Found in file perl.h =over 4 =item C X Returns the value of an ASCII-range hex digit and advances the string pointer. Behaviour is only well defined when isXDIGIT(*str) is true. =over 3 U8 READ_XDIGIT(char str*) =back =back =for hackers Found in file handy.h =over 4 =item C X For backwards compatibility. Use C instead. =over 3 NV scan_bin(const char *start, STRLEN len, STRLEN *retlen) =back =back =for hackers Found in file numeric.c =over 4 =item C X For backwards compatibility. Use C instead. =over 3 NV scan_hex(const char *start, STRLEN len, STRLEN *retlen) =back =back =for hackers Found in file numeric.c =over 4 =item C X For backwards compatibility. Use C instead. =over 3 NV scan_oct(const char *start, STRLEN len, STRLEN *retlen) =back =back =for hackers Found in file numeric.c =over 4 =item C X This symbol defines the macro to be used in seeding the random number generator (see C>). =over 3 void seedDrand01(Rand_seed_t x) =back =back =for hackers Found in file handy.h =over 4 =item C X This is a synonym for L. =over 3 NV Strtod(NN const char * const s, NULLOK char ** e) =back =back =for hackers Found in file perl.h =over 4 =item C X Platform and configuration independent C. This expands to the appropriate C-like function based on the platform and F options>. For example it could expand to C or C instead of C. =over 3 NV Strtol(NN const char * const s, NULLOK char ** e, int base) =back =back =for hackers Found in file perl.h =over 4 =item C X Platform and configuration independent C. This expands to the appropriate C-like function based on the platform and F options>. For example it could expand to C or C instead of C. =over 3 NV Strtoul(NN const char * const s, NULLOK char ** e, int base) =back =back =for hackers Found in file perl.h =head1 Optrees XXXXXX =over 4 =item C X NOTE: C is B and may change or be removed without notice. Available only under threaded builds, this function allocates an entry in C for the stash passed to it. =over 3 PADOFFSET alloccopstash(HV *hv) =back =back =for hackers Found in file op.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Handles compile-time scope exit. C is the savestack index returned by C, and C is the body of the block. Returns the block, possibly modified. =over 3 OP * block_end(I32 floor, OP *seq) =back =back =for hackers Found in file op.c =over 4 =item C X Handles compile-time scope entry. Arranges for hints to be restored on block exit and also handles pad sequence numbers to make lexical variables scope right. Returns a savestack index for use with C. =over 3 int block_start(int full) =back =back =for hackers Found in file op.c =over 4 =item C X Performs the default fixup of the arguments part of an C op tree. This consists of applying list context to each of the argument ops. This is the standard treatment used on a call marked with C<&>, or a method call, or a call through a subroutine reference, or any other call where the callee can't be identified at compile time, or a call where the callee has no prototype. =over 3 OP * ck_entersub_args_list(OP *entersubop) =back =back =for hackers Found in file op.c =over 4 =item C X Performs the fixup of the arguments part of an C op tree based on a subroutine prototype. This makes various modifications to the argument ops, from applying context up to inserting C ops, and checking the number and syntactic types of arguments, as directed by the prototype. This is the standard treatment used on a subroutine call, not marked with C<&>, where the callee can be identified at compile time and has a prototype. C supplies the subroutine prototype to be applied to the call. It may be a normal defined scalar, of which the string value will be used. Alternatively, for convenience, it may be a subroutine object (a C that has been cast to C) which has a prototype. The prototype supplied, in whichever form, does not need to match the actual callee referenced by the op tree. If the argument ops disagree with the prototype, for example by having an unacceptable number of arguments, 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. In the error message, the callee is referred to by the name defined by the C parameter. =over 3 OP * ck_entersub_args_proto(OP *entersubop, GV *namegv, SV *protosv) =back =back =for hackers Found in file op.c =over 4 =item C X Performs the fixup of the arguments part of an C op tree either based on a subroutine prototype or using default list-context processing. This is the standard treatment used on a subroutine call, not marked with C<&>, where the callee can be identified at compile time. C supplies the subroutine prototype to be applied to the call, or indicates that there is no prototype. It may be a normal scalar, in which case if it is defined then the string value will be used as a prototype, and if it is undefined then there is no prototype. Alternatively, for convenience, it may be a subroutine object (a C that has been cast to C), of which the prototype will be used if it has one. The prototype (or lack thereof) supplied, in whichever form, does not need to match the actual callee referenced by the op tree. If the argument ops disagree with the prototype, for example by having an unacceptable number of arguments, 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. In the error message, the callee is referred to by the name defined by the C parameter. =over 3 OP * ck_entersub_args_proto_or_list(OP *entersubop, GV *namegv, SV *protosv) =back =back =for hackers Found in file op.c =over 4 =item C X If C is a constant sub eligible for inlining, returns the constant value returned by the sub. Otherwise, returns C. Constant subs can be created with C or as described in L. =over 3 SV * cv_const_sv(const CV * const cv) =back =back =for hackers Found in file op.c =over 4 =item C X The original form of L, which does not return checker flags. When using a checker function returned by this function, it is only safe to call it with a genuine GV as its C argument. =over 3 void cv_get_call_checker(CV *cv, Perl_call_checker *ckfun_p, SV **ckobj_p) =back =back =for hackers Found in file op.c =over 4 =item C X Retrieves the function that will be used to fix up a call to C. Specifically, the function is applied to an C op tree for a subroutine call, not marked with C<&>, where the callee can be identified at compile time as C. The C-level function pointer is returned in C<*ckfun_p>, an SV argument for it is returned in C<*ckobj_p>, and control flags are returned in C<*ckflags_p>. The function is intended to be called in this manner: entersubop = (*ckfun_p)(aTHX_ entersubop, namegv, (*ckobj_p)); In this call, C is a pointer to the C op, which may be replaced by the check function, and C supplies the name that should be used by the check function to refer to the callee of the C op if it needs to emit any diagnostics. It is permitted to apply the check function in non-standard situations, such as to a call to a different subroutine or to a method call. C may not actually be a GV. If the C bit is clear in C<*ckflags_p>, it is permitted to pass a CV or other SV instead, anything that can be used as the first argument to L. If the C bit is set in C<*ckflags_p> then the check function requires C to be a genuine GV. By default, the check function is L, the SV parameter is C itself, and the C flag is clear. This implements standard prototype processing. It can be changed, for a particular subroutine, by L. If the C bit is set in C then it indicates that the caller only knows about the genuine GV version of C, and accordingly the corresponding bit will always be set in C<*ckflags_p>, regardless of the check function's recorded requirements. If the C bit is clear in C then it indicates the caller knows about the possibility of passing something other than a GV as C, and accordingly the corresponding bit may be either set or clear in C<*ckflags_p>, indicating the check function's recorded requirements. C is a bitset passed into C, in which only the C bit currently has a defined meaning (for which see above). All other bits should be clear. =over 3 void cv_get_call_checker_flags(CV *cv, U32 gflags, Perl_call_checker *ckfun_p, SV **ckobj_p, U32 *ckflags_p) =back =back =for hackers Found in file op.c =over 4 =item C X The original form of L, which passes it the C flag for backward-compatibility. The effect of that flag setting is that the check function is guaranteed to get a genuine GV as its C argument. =over 3 void cv_set_call_checker(CV *cv, Perl_call_checker ckfun, SV *ckobj) =back =back =for hackers Found in file op.c =over 4 =item C X Sets the function that will be used to fix up a call to C. Specifically, the function is applied to an C op tree for a subroutine call, not marked with C<&>, where the callee can be identified at compile time as C. The C-level function pointer is supplied in C, an SV argument for it is supplied in C, and control flags are supplied in C. The function should be defined like this: STATIC OP * ckfun(pTHX_ OP *op, GV *namegv, SV *ckobj) It is intended to be called in this manner: entersubop = ckfun(aTHX_ entersubop, namegv, ckobj); In this call, C is a pointer to the C op, which may be replaced by the check function, and C supplies the name that should be used by the check function to refer to the callee of the C op if it needs to emit any diagnostics. It is permitted to apply the check function in non-standard situations, such as to a call to a different subroutine or to a method call. C may not actually be a GV. For efficiency, perl may pass a CV or other SV instead. Whatever is passed can be used as the first argument to L. You can force perl to pass a GV by including C in the C. C is a bitset, in which only the C bit currently has a defined meaning (for which see above). All other bits should be clear. The current setting for a particular CV can be retrieved by L. =over 3 void cv_set_call_checker_flags(CV *cv, Perl_call_checker ckfun, SV *ckobj, U32 ckflags) =back =back =for hackers Found in file op.c =over 4 =item C X This function finalizes the optree. Should be called directly after the complete optree is built. It does some additional checking which can't be done in the normal Cxxx functions and makes the tree thread-safe. =over 3 void finalize_optree(OP *o) =back =back =for hackers Found in file peep.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Checks an optree that implements a block, to ensure there are no control-flow ops that attempt to leave the block. Any C is forbidden, as is any C. Loops are analysed, so any LOOPEX op (C, C or C) that affects a loop that contains it within the block are permitted, but those that do not are forbidden. If any of these forbidden constructions are detected, an exception is thrown by using the op name and the blockname argument to construct a suitable message. This function alone is not sufficient to ensure the optree does not perform any of these forbidden activities during runtime, as it might call a different function that performs a non-local LOOPEX, or a string-eval() that performs a C, or various other things. It is intended purely as a compile-time check for those that could be detected statically. Additional runtime checks may be required depending on the circumstance it is used for. Note currently that I C ops are forbidden, even in cases where they might otherwise be safe to execute. This may be permitted in a later version. =over 3 void forbid_outofblock_ops(OP *o, const char *blockname) =back =back =for hackers Found in file op.c =over 4 =item C X Given the root of an optree, link the tree in execution order using the C pointers and return the first op executed. If this has already been done, it will not be redone, and C<< o->op_next >> will be returned. If C<< o->op_next >> is not already set, C should be at least an C. =over 3 OP* LINKLIST(OP *o) =back =back =for hackers Found in file op.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Constructs and returns a new C op which provides a defaulting expression given by C for the signature parameter at the index given by C. The expression optree is consumed by this function and becomes part of the returned optree. =over 3 OP * newARGDEFELEMOP(I32 flags, OP *expr, I32 argindex) =back =back =for hackers Found in file op.c =over 4 =item C X Constructs, checks, and returns an assignment op. C and C supply the parameters of the assignment; they are consumed by this function and become part of the constructed op tree. If C is C, C, or C, then a suitable conditional optree is constructed. If C 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 C is non-zero then C has no effect. If C is zero, then a plain scalar or list assignment is constructed. Which type of assignment it is is automatically determined. C 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. =over 3 OP * newASSIGNOP(I32 flags, OP *left, I32 optype, OP *right) =back =back =for hackers Found in file op.c =over 4 =item C X Construct a Perl subroutine, also performing some surrounding jobs. This is the same as L> with its C parameter set to FALSE. This means that if C is null, the new sub will be anonymous; otherwise the name will be derived from C in the way described (as with all other details) in L>. =over 3 CV * newATTRSUB(I32 floor, OP *o, OP *proto, OP *attrs, OP *block) =back =back =for hackers Found in file op.c =over 4 =item C X Constructs, checks, and returns an op of any binary type. C is the opcode. C 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. C and C 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. =over 3 OP * newBINOP(I32 type, I32 flags, OP *first, OP *last) =back =back =for hackers Found in file op.c =over 4 =item C X Constructs, checks, and returns a conditional-expression (C) op. C 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. C supplies the expression selecting between the two branches, and C and C supply the branches; they are consumed by this function and become part of the constructed op tree. =over 3 OP * newCONDOP(I32 flags, OP *first, OP *trueop, OP *falseop) =back =back =for hackers Found in file op.c =over 4 =item C X Behaves like L, except that C is nul-terminated rather than of counted length, and no flags are set. (This means that C is always interpreted as Latin-1.) =over 3 CV * newCONSTSUB(HV *stash, const char *name, SV *sv) =back =back =for hackers Found in file op.c =over 4 =item C X Construct a constant subroutine, also performing some surrounding jobs. A scalar constant-valued subroutine is eligible for inlining at compile-time, and in Perl code can be created by S>. Other kinds of constant subroutine have other treatment. The subroutine will have an empty prototype and will ignore any arguments when called. Its constant behaviour is determined by C. If C is null, the subroutine will yield an empty list. If C points to a scalar, the subroutine will always yield that scalar. If C points to an array, the subroutine will always yield a list of the elements of that array in list context, or the number of elements in the array in scalar context. This function takes ownership of one counted reference to the scalar or array, and will arrange for the object to live as long as the subroutine does. If C points to a scalar then the inlining assumes that the value of the scalar will never change, so the caller must ensure that the scalar is not subsequently written to. If C points to an array then no such assumption is made, so it is ostensibly safe to mutate the array or its elements, but whether this is really supported has not been determined. The subroutine will have C set according to C. Other aspects of the subroutine will be left in their default state. The caller is free to mutate the subroutine beyond its initial state after this function has returned. If C is null then the subroutine will be anonymous, with its C referring to an C<__ANON__> glob. If C is non-null then the subroutine will be named accordingly, referenced by the appropriate glob. C is a string of length C bytes giving a sigilless symbol name, in UTF-8 if C has the C bit set and in Latin-1 otherwise. The name may be either qualified or unqualified. If the name is unqualified then it defaults to being in the stash specified by C if that is non-null, or to C if C is null. The symbol is always added to the stash if necessary, with C semantics. C should not have bits set other than C. If there is already a subroutine of the specified name, then the new sub will replace the existing one in the glob. A warning may be generated about the redefinition. If the subroutine has one of a few special names, such as C or C, then it will be claimed by the appropriate queue for automatic running of phase-related subroutines. In this case the relevant glob will be left not containing any subroutine, even if it did contain one before. Execution of the subroutine will likely be a no-op, unless C was a tied array or the caller modified the subroutine in some interesting way before it was executed. In the case of C, the treatment is buggy: the sub will be executed when only half built, and may be deleted prematurely, possibly causing a crash. The function returns a pointer to the constructed subroutine. If the sub is anonymous then ownership of one counted reference to the subroutine is transferred to the caller. If the sub is named then the caller does not get ownership of a reference. In most such cases, where the sub has a non-phase name, the sub will be alive at the point it is returned by virtue of being contained in the glob that names it. A phase-named subroutine will usually be alive by virtue of the reference owned by the phase's automatic run queue. A C subroutine may have been destroyed already by the time this function returns, but currently bugs occur in that case before the caller gets control. It is the caller's responsibility to ensure that it knows which of these situations applies. =over 3 CV * newCONSTSUB_flags(HV *stash, const char *name, STRLEN len, U32 flags, SV *sv) =back =back =for hackers Found in file op.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Constructs and returns a deferred-block statement that implements the C semantics. The C optree is consumed by this function and becomes part of the returned optree. The C argument carries additional flags to set on the returned op, including the C field. =over 3 OP * newDEFEROP(I32 flags, OP *block) =back =back =for hackers Found in file op.c =over 4 =item C X Constructs and returns an op to access C<$_>. =over 3 OP * newDEFSVOP() =back =back =for hackers Found in file op.c =over 4 =item C 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. C optionally supplies the variable(s) that will be aliased to each item in turn; if null, it defaults to C<$_>. C supplies the list of values to iterate over. C supplies the main body of the loop, and C 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. C 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. =over 3 OP * newFOROP(I32 flags, OP *sv, OP *expr, OP *block, OP *cont) =back =back =for hackers Found in file op.c =over 4 =item C X Constructs, checks, and returns an op tree expressing a C block. C supplies the expression to whose value C<$_> will be locally aliased, and C supplies the body of the C construct; they are consumed by this function and become part of the constructed op tree. C must be zero (it used to identity the pad slot of lexical $_). =over 3 OP * newGIVENOP(OP *cond, OP *block, PADOFFSET defsv_off) =back =back =for hackers Found in file op.c =over 4 =item C X Constructs, checks, and returns an op of any type that involves an embedded reference to a GV. C is the opcode. C gives the eight bits of C. C identifies the GV that the op should reference; calling this function does not transfer ownership of any reference to it. =over 3 OP * newGVOP(I32 type, I32 flags, GV *gv) =back =back =for hackers Found in file op.c =over 4 =item C X Constructs, checks, and returns an op of any list type. C is the opcode. C gives the eight bits of C, except that C will be set automatically if required. C and C 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. For most list operators, the check function expects all the kid ops to be present already, so calling C (e.g.) is not appropriate. What you want to do in that case is create an op of type C, append more children to it, and then call L. See L for more information. =over 3 OP * newLISTOP(I32 type, I32 flags, OP *first, OP *last) =back =back =for hackers Found in file op.c =over 4 =item C X Constructs, checks, and returns a logical (flow control) op. C is the opcode. C 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. C supplies the expression controlling the flow, and C supplies the side (alternate) chain of ops; they are consumed by this function and become part of the constructed op tree. =over 3 OP * newLOGOP(I32 optype, I32 flags, OP *first, OP *other) =back =back =for hackers Found in file op.c =over 4 =item C X Constructs, checks, and returns a loop-exiting op (such as C or C). C is the opcode. C macro. It should not be called directly. =over 3 OP * op_linklist(OP *o) =back =back =for hackers Found in file op.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Propagate lvalue ("modifiable") context to an op and its children. C represents the context type, roughly based on the type of op that would do the modifying, although C is represented by C, because it has no op type of its own (it is signalled by a flag on the lvalue op). This function detects things that can't be modified, such as C<$x+1>, and generates errors for them. For example, C<$x+1 = 2> would cause it to be called with an op of type C and a C argument of C. It also flags things that need to behave specially in an lvalue context, such as C<$$x = 5> which might have to vivify a reference in C<$x>. =over 3 OP * op_lvalue(OP *o, I32 type) =back =back =for hackers Found in file op.c =over 4 =item C X Conditionally does C or C depending on whether C is non-null. For a higher-level interface, see C>. =over 3 void OpMAYBESIB_set(OP *o, OP *sib, OP *parent) =back =back =for hackers Found in file op.h =over 4 =item C X Sets the sibling of C to the non-zero value C. See also C> and C>. For a higher-level interface, see C>. =over 3 void OpMORESIB_set(OP *o, OP *sib) =back =back =for hackers Found in file op.h =over 4 =item C X Return the name of the provided OP. For core ops this looks up the name from the op_type; for custom ops from the op_ppaddr. =over 3 const char * OP_NAME(OP *o) =back =back =for hackers Found in file op.h =over 4 =item C X Neutralizes an op when it is no longer needed, but is still linked to from other ops. =over 3 void op_null(OP *o) =back =back =for hackers Found in file op.c =over 4 =item C X Returns the parent OP of C, if it has a parent. Returns C otherwise. =over 3 OP * op_parent(OP *o) =back =back =for hackers Found in file op.c =over 4 =item C X Prepend an item to the list of ops contained directly within a list-type op, returning the lengthened list. C is the op to prepend to the list, and C is the list-type op. C specifies the intended opcode for the list. If C is not already a list of the right type, it will be upgraded into one. If either C or C is null, the other is returned unchanged. =over 3 OP * op_prepend_elem(I32 optype, OP *first, OP *last) =back =back =for hackers Found in file op.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Wraps up an op tree with some additional ops so that at runtime a dynamic scope will be created. The original ops run in the new dynamic scope, and then, provided that they exit normally, the scope will be unwound. The additional ops used to create and unwind the dynamic scope will normally be an C/C pair, but a C op may be used instead if the ops are simple enough to not need the full dynamic scope structure. =over 3 OP * op_scope(OP *o) =back =back =for hackers Found in file op.c =over 4 =item C X Returns the sibling of C, or C if there is no sibling =over 3 OP* OpSIBLING(OP *o) =back =back =for hackers Found in file op.h =over 4 =item C X A general function for editing the structure of an existing chain of op_sibling nodes. By analogy with the perl-level C function, allows you to delete zero or more sequential nodes, replacing them with zero or more different nodes. Performs the necessary op_first/op_last housekeeping on the parent node and op_sibling manipulation on the children. The last deleted node will be marked as the last node by updating the op_sibling/op_sibparent or op_moresib field as appropriate. Note that op_next is not manipulated, and nodes are not freed; that is the responsibility of the caller. It also won't create a new list op for an empty list etc; use higher-level functions like op_append_elem() for that. C is the parent node of the sibling chain. It may passed as C if the splicing doesn't affect the first or last op in the chain. C is the node preceding the first node to be spliced. Node(s) following it will be deleted, and ops will be inserted after it. If it is C, the first node onwards is deleted, and nodes are inserted at the beginning. C is the number of nodes to delete. If zero, no nodes are deleted. If -1 or greater than or equal to the number of remaining kids, all remaining kids are deleted. C is the first of a chain of nodes to be inserted in place of the nodes. If C, no nodes are inserted. The head of the chain of deleted ops is returned, or C if no ops were deleted. For example: action before after returns ------ ----- ----- ------- P P splice(P, A, 2, X-Y-Z) | | B-C A-B-C-D A-X-Y-Z-D P P splice(P, NULL, 1, X-Y) | | A A-B-C-D X-Y-B-C-D P P splice(P, NULL, 3, NULL) | | A-B-C A-B-C-D D P P splice(P, B, 0, X-Y) | | NULL A-B-C-D A-B-X-Y-C-D For lower-level direct manipulation of C and C, see C>, C>, C>. =over 3 OP * op_sibling_splice(OP *parent, OP *start, int del_count, OP *insert) =back =back =for hackers Found in file op.c =over 4 =item C X This function applies some optimisations to the optree in top-down order. It is called before the peephole optimizer, which processes ops in execution order. Note that finalize_optree() also does a top-down scan, but is called *after* the peephole optimizer. =over 3 void optimize_optree(OP *o) =back =back =for hackers Found in file peep.c =over 4 =item C X Returns true if the given OP is not a C pointer and if it is of the given type. The negation of this macro, C is also available as well as C and C which elide the NULL pointer check. =over 3 bool OP_TYPE_IS(OP *o, Optype type) =back =back =for hackers Found in file op.h =over 4 =item C X Returns true if the given OP is not a NULL pointer and if it is of the given type or used to be before being replaced by an OP of type OP_NULL. The negation of this macro, C is also available as well as C and C which elide the C pointer check. =over 3 bool OP_TYPE_IS_OR_WAS(OP *o, Optype type) =back =back =for hackers Found in file op.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Wraps the given C optree fragment in its own scoped block, arranging for the C optree fragment to be invoked when leaving that block for any reason. Both optree fragments are consumed and the combined result is returned. =over 3 OP * op_wrap_finally(OP *block, OP *finally) =back =back =for hackers Found in file op.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X When non-C, the function pointed by this variable will be called each time an OP is freed with the corresponding OP as the argument. This allows extensions to free any extra attribute they have locally attached to an OP. It is also assured to first fire for the parent OP and then for its kids. When you replace this variable, it is considered a good practice to store the possibly previously installed hook and that you recall it inside your own. On threaded perls, each thread has an independent copy of this variable; each initialized at creation time with the current value of the creating thread's copy. =over 3 Perl_ophook_t PL_opfreehook =back =back =for hackers Found in file intrpvar.h =over 4 =item C X Pointer to the per-subroutine peephole optimiser. This is a function that gets called at the end of compilation of a Perl subroutine (or equivalently independent piece of Perl code) to perform fixups of some ops and to perform small-scale optimisations. The function is called once for each subroutine that is compiled, and is passed, as sole parameter, a pointer to the op that is the entry point to the subroutine. It modifies the op tree in place. The peephole optimiser should never be completely replaced. Rather, add code to it by wrapping the existing optimiser. The basic way to do this can be seen in L. If the new code wishes to operate on ops throughout the subroutine's structure, rather than just at the top level, it is likely to be more convenient to wrap the L hook. On threaded perls, each thread has an independent copy of this variable; each initialized at creation time with the current value of the creating thread's copy. =over 3 peep_t PL_peepp =back =back =for hackers Found in file intrpvar.h =over 4 =item C X Pointer to the recursive peephole optimiser. This is a function that gets called at the end of compilation of a Perl subroutine (or equivalently independent piece of Perl code) to perform fixups of some ops and to perform small-scale optimisations. The function is called once for each chain of ops linked through their C fields; it is recursively called to handle each side chain. It is passed, as sole parameter, a pointer to the op that is at the head of the chain. It modifies the op tree in place. The peephole optimiser should never be completely replaced. Rather, add code to it by wrapping the existing optimiser. The basic way to do this can be seen in L. If the new code wishes to operate only on ops at a subroutine's top level, rather than throughout the structure, it is likely to be more convenient to wrap the L hook. On threaded perls, each thread has an independent copy of this variable; each initialized at creation time with the current value of the creating thread's copy. =over 3 peep_t PL_rpeepp =back =back =for hackers Found in file intrpvar.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Examines an op, which is expected to identify a subroutine at runtime, and attempts to determine at compile time which subroutine it identifies. This is normally used during Perl compilation to determine whether a prototype can be applied to a function call. C is the op being considered, normally an C op. A pointer to the identified subroutine is returned, if it could be determined statically, and a null pointer is returned if it was not possible to determine statically. Currently, the subroutine can be identified statically if the RV that the C is to operate on is provided by a suitable C or C op. A C op is suitable if the GV's CV slot is populated. A C op is suitable if the constant value must be an RV pointing to a CV. Details of this process may change in future versions of Perl. If the C op has the C flag set then no attempt is made to identify the subroutine statically: this flag is used to suppress compile-time magic on a subroutine call, forcing it to use default runtime behaviour. If C has the bit C set, then the handling of a GV reference is modified. If a GV was examined and its CV slot was found to be empty, then the C op has the C flag set. If the op is not optimised away, and the CV slot is later populated with a subroutine having a prototype, that flag eventually triggers the warning "called too early to check prototype". If C has the bit C set, then instead of returning a pointer to the subroutine it returns a pointer to the GV giving the most appropriate name for the subroutine in this context. Normally this is just the C of the subroutine, but for an anonymous (C) subroutine that is referenced through a GV it will be the referencing GV. The resulting C is cast to C to be returned. A null pointer is returned as usual if there is no statically-determinable subroutine. =over 3 CV * rv2cv_op_cv(OP *cvop, U32 flags) =back =back =for hackers Found in file op.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =head1 Pack and Unpack =over 4 =item C X The engine implementing C Perl function. =over 3 void packlist(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist) =back =back =for hackers Found in file pp_pack.c =over 4 =item C X The engine implementing the C Perl function. Using the template C, this function unpacks the string C into a number of mortal SVs, which it pushes onto the perl argument (C<@_>) stack (so you will need to issue a C before and C after the call to this function). It returns the number of pushed elements. The C and C pointers should point to the byte following the last character of each string. Although this function returns its values on the perl argument stack, it doesn't take any parameters from that stack (and thus in particular there's no need to do a C before calling it, unlike L for example). =over 3 SSize_t unpackstring(const char *pat, const char *patend, const char *s, const char *strend, U32 flags) =back =back =for hackers Found in file pp_pack.c =head1 Pad Data Structures X =over 4 =item C X NOTE: C is B and may change or be removed without notice. CV's can have CvPADLIST(cv) set to point to a PADLIST. This is the CV's scratchpad, which stores lexical variables and opcode temporary and per-thread values. For these purposes "formats" are a kind-of CV; eval""s are too (except they're not callable at will and are always thrown away after the eval"" is done executing). Require'd files are simply evals without any outer lexical scope. XSUBs do not have a C. C fetches values from C, but that is really the callers pad (a slot of which is allocated by every entersub). Do not get or set C if a CV is an XSUB (as determined by C), C slot is reused for a different internal purpose in XSUBs. The PADLIST has a C array where pads are stored. The 0th entry of the PADLIST is a PADNAMELIST which represents the "names" or rather the "static type information" for lexicals. The individual elements of a PADNAMELIST are PADNAMEs. Future refactorings might stop the PADNAMELIST from being stored in the PADLIST's array, so don't rely on it. See L. The CvDEPTH'th entry of a PADLIST is a PAD (an AV) which is the stack frame at that depth of recursion into the CV. The 0th slot of a frame AV is an AV which is C<@_>. Other entries are storage for variables and op targets. Iterating over the PADNAMELIST iterates over all possible pad items. Pad slots for targets (C) and GVs end up having &PL_padname_undef "names", while slots for constants have C<&PL_padname_const> "names" (see C>). That C<&PL_padname_undef> and C<&PL_padname_const> are used is an implementation detail subject to change. To test for them, use C and S>, respectively. Only C/C variable slots get valid names. The rest are op targets/GVs/constants which are statically allocated or resolved at compile time. These don't have names by which they can be looked up from Perl code at run time through eval"" the way C/C variables can be. Since they can't be looked up by "name" but only by their index allocated at compile time (which is usually in C<< PL_op->op_targ >>), wasting a name SV for them doesn't make sense. The pad names in the PADNAMELIST have their PV holding the name of the variable. The C and C<_HIGH> fields form a range (low+1..high inclusive) of cop_seq numbers for which the name is valid. During compilation, these fields may hold the special value PERL_PADSEQ_INTRO to indicate various stages: COP_SEQ_RANGE_LOW _HIGH ----------------- ----- PERL_PADSEQ_INTRO 0 variable not yet introduced: { my ($x valid-seq# PERL_PADSEQ_INTRO variable in scope: { my ($x); valid-seq# valid-seq# compilation of scope complete: { my ($x); .... } When a lexical var hasn't yet been introduced, it already exists from the perspective of duplicate declarations, but not for variable lookups, e.g. my ($x, $x); # '"my" variable $x masks earlier declaration' my $x = $x; # equal to my $x = $::x; For typed lexicals C points at the type stash. For C lexicals, C points at the stash of the associated global (so that duplicate C declarations in the same package can be detected). C is sometimes used to store the generation number during compilation. If C is set on the pad name, then that slot in the frame AV is a REFCNT'ed reference to a lexical from "outside". Such entries are sometimes referred to as 'fake'. In this case, the name does not use 'low' and 'high' to store a cop_seq range, since it is in scope throughout. Instead 'high' stores some flags containing info about the real lexical (is it declared in an anon, and is it capable of being instantiated multiple times?), and for fake ANONs, 'low' contains the index within the parent's pad where the lexical's value is stored, to make cloning quicker. If the 'name' is C<&> the corresponding entry in the PAD is a CV representing a possible closure. Note that formats are treated as anon subs, and are cloned each time write is called (if necessary). The flag C is cleared on lexicals each time the C is executed, and set on scope exit. This allows the C<"Variable $x is not available"> warning to be generated in evals, such as { my $x = 1; sub f { eval '$x'} } f(); For state vars, C is overloaded to mean 'not yet initialised', but this internal state is stored in a separate pad entry. =over 3 PADLIST * CvPADLIST(CV *cv) =back =back =for hackers Found in file pad.c =over 4 =item C X Exactly like L, but takes a literal string instead of a string/length pair. =over 3 PADOFFSET pad_add_name_pvs("name", U32 flags, HV *typestash, HV *ourstash) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The C array of pad entries. =over 3 SV ** PadARRAY(PAD * pad) =back =back =for hackers Found in file pad.h =over 4 =item C X Exactly like L, but takes a literal string instead of a string/length pair. =over 3 PADOFFSET pad_findmy_pvs("name", U32 flags) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The C array of a padlist, containing the pads. Only subscript it with numbers >= 1, as the 0th entry is not guaranteed to remain usable. =over 3 PAD ** PadlistARRAY(PADLIST * padlist) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The index of the last allocated space in the padlist. Note that the last pad may be in an earlier slot. Any entries following it will be C in that case. =over 3 SSize_t PadlistMAX(PADLIST * padlist) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The names associated with pad entries. =over 3 PADNAMELIST * PadlistNAMES(PADLIST * padlist) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The C array of pad names. =over 3 PADNAME ** PadlistNAMESARRAY(PADLIST * padlist) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The index of the last pad name. =over 3 SSize_t PadlistNAMESMAX(PADLIST * padlist) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The reference count of the padlist. Currently this is always 1. =over 3 U32 PadlistREFCNT(PADLIST * padlist) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The index of the last pad entry. =over 3 SSize_t PadMAX(PAD * pad) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The length of the name. =over 3 STRLEN PadnameLEN(PADNAME * pn) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The C array of pad names. =over 3 PADNAME ** PadnamelistARRAY(PADNAMELIST * pnl) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The index of the last pad name. =over 3 SSize_t PadnamelistMAX(PADNAMELIST * pnl) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The reference count of the pad name list. =over 3 SSize_t PadnamelistREFCNT(PADNAMELIST * pnl) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Lowers the reference count of the pad name list. =over 3 void PadnamelistREFCNT_dec(PADNAMELIST * pnl) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The name stored in the pad name struct. This returns C for a target slot. =over 3 char * PadnamePV(PADNAME * pn) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. The reference count of the pad name. =over 3 SSize_t PadnameREFCNT(PADNAME * pn) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Lowers the reference count of the pad name. =over 3 void PadnameREFCNT_dec(PADNAME * pn) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Increases the reference count of the pad name. Returns the pad name itself. =over 3 PADNAME * PadnameREFCNT_inc(PADNAME * pn) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Returns the pad name as a mortal SV. =over 3 SV * PadnameSV(PADNAME * pn) =back =back =for hackers Found in file pad.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Whether PadnamePV is in UTF-8. Currently, this is always true. =over 3 bool PadnameUTF8(PADNAME * pn) =back =back =for hackers Found in file pad.h =over 4 =item C X Create a new padlist, updating the global variables for the currently-compiling padlist to point to the new padlist. The following flags can be OR'ed together: padnew_CLONE this pad is for a cloned CV padnew_SAVE save old globals on the save stack padnew_SAVESUB also save extra stuff for start of sub =over 3 PADLIST * pad_new(int flags) =back =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. During compilation, this points to the array containing the values part of the pad for the currently-compiling code. (At runtime a CV may have many such value arrays; at compile time just one is constructed.) At runtime, this points to the array containing the currently-relevant values for the pad for the currently-executing code. =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. During compilation, this points to the array containing the names part of the pad for the currently-compiling code. =back =for hackers Found in file pad.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Points directly to the body of the L array. (I.e., this is C.) =back =for hackers Found in file pad.c =over 4 =item C C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =head1 Password and Group access =over 4 =item C X This symbol, if defined, indicates to the C program that C in F contains C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the getgrent routine is available for finalizing sequential access of the group database. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to endgrent re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available for finalizing sequential access of the passwd database. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to endpwent re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available for sequential access of the group database. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to getgrent re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available for sequential access of the passwd database. If this is not available, the older C function may be available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to getpwent re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available for initializing sequential access of the group database. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to setgrent re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available for initializing sequential access of the passwd database. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to setpwent re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that C contains C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that C contains C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that C contains C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that C contains C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that C contains C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that C contains C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that C contains C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that C contains C. =back =for hackers Found in file config.h =head1 Paths to system commands =over 4 =item C X This symbol, if defined, contains the full pathname of csh. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the complete pathname to the sed program. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the full pathname to the shell used on this on this system to execute Bourne shell scripts. Usually, this will be F, though it's possible that some systems will have F, F, F, F, or even something such as D:F. =back =for hackers Found in file config.h =head1 Prototype information =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F uses real C C prototypes instead of K&R style function declarations without any parameter information. While C C prototypes are supported in C++, K&R style function declarations will yield errors. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that > uses real C C prototypes instead of K&R style function declarations without any parameter information. While C C prototypes are supported in C++, K&R style function declarations will yield errors. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. A good guess is extern int dbminit(char *); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. A good guess is extern double drand48(void); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. A good guess is extern int flock(int, int); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F includes prototypes for C, C, and C. Otherwise, it is up to the program to guess them. See netdbtype.U (part of metaconfig) for probing for various C types. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F includes prototypes for C, C, and C. Otherwise, it is up to the program to guess them. See netdbtype.U (part of metaconfig) for probing for various C types. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F includes prototypes for C, C, and C. Otherwise, it is up to the program to guess them. See netdbtype.U (part of metaconfig) for probing for various C types. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F includes prototypes for C, C, and C. Otherwise, it is up to the program to guess them. See netdbtype.U (part of metaconfig) for probing for various C types. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. Good guesses are extern void* sbrk(int); extern void* sbrk(size_t); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. Good guesses are extern int setresgid(uid_t ruid, uid_t euid, uid_t suid); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. Good guesses are extern int setresuid(uid_t ruid, uid_t euid, uid_t suid); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the F includes a prototype for C. Otherwise, it is up to the program to guess one. C C is a good guess, but not always right so it should be emitted by the program only when C is not defined to avoid conflicting defs. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. A good guess is extern int sockatmark(int); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. Good guesses are extern int syscall(int, ...); extern int syscall(long, ...); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. A good guess is extern long telldir(DIR*); =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F uses real C C prototypes instead of K&R style function declarations without any parameter information. While C C prototypes are supported in C++, K&R style function declarations will yield errors. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =head1 REGEXP Functions =over 4 =item C Described in L. =over 3 REGEXP * pregcomp(SV * const pattern, const U32 flags) =back =back =for hackers Found in file pod/perlreguts.pod =over 4 =item C Described in L. =over 3 I32 pregexec(REGEXP * const prog, char *stringarg, char *strend, char *strbeg, SSize_t minend, SV *screamer, U32 nosave) =back =back =for hackers Found in file pod/perlreguts.pod =over 4 =item C X Compile the regular expression pattern C, returning a pointer to the compiled object for later matching with the internal regex engine. This function is typically used by a custom regexp engine C<.comp()> function to hand off to the core regexp engine those patterns it doesn't want to handle itself (typically passing through the same flags it was called with). In almost all other cases, a regexp should be compiled by calling L> to compile using the currently active regexp engine. If C is already a C, this function does nothing but return a pointer to the input. Otherwise the PV is extracted and treated like a string representing a pattern. See L. The possible flags for C are documented in L. Their names all begin with C. =over 3 REGEXP * re_compile(SV * const pattern, U32 orig_rx_flags) =back =back =for hackers Found in file regcomp.c =over 4 =item C X Duplicate a regexp. This routine is expected to clone a given regexp structure. It is only compiled under USE_ITHREADS. After all of the core data stored in struct regexp is duplicated the C method is used to copy any private data stored in the *pprivate pointer. This allows extensions to handle any duplication they need to do. =over 3 void re_dup_guts(const REGEXP *sstr, REGEXP *dstr, CLONE_PARAMS *param) =back =back =for hackers Found in file regcomp.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C X When a regexp is compiled, its C field is then set to point at the appropriate structure, so that when it needs to be used Perl can find the right routines to do so. In order to install a new regexp handler, C<$^H{regcomp}> is set to an integer which (when casted appropriately) resolves to one of these structures. When compiling, the C method is executed, and the resulting C structure's engine field is expected to point back at the same structure. The pTHX_ symbol in the definition is a macro used by Perl under threading to provide an extra argument to the routine holding a pointer back to the interpreter that is executing the regexp. So under threading all routines get an extra argument. =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C X Some basic information about the current match that is created by Perl_regexec_flags and then passed to regtry(), regmatch() etc. It is allocated as a local var on the stack, so nothing should be stored in it that needs preserving or clearing up on croak(). For that, see the aux_info and aux_info_eval members of the regmatch_state union. =back =for hackers Found in file regexp.h =over 4 =item C =item C =item C Described in L. =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C Described in L. =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C =item C =item C =item C =item C =item C Described in L. =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C =item C =item C =item C =item C =item C Described in L. =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C =item C =item C =item C =item C Described in L. =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C Described in L. =over 3 RX_MATCH_COPIED(const REGEXP * rx) =back =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C Described in L. =over 3 RX_OFFS(const REGEXP * rx_sv) =back =back =for hackers Found in file pod/perlreapi.pod =over 4 =item C X Convenience macro to get the REGEXP from a SV. This is approximately equivalent to the following snippet: if (SvMAGICAL(sv)) mg_get(sv); if (SvROK(sv)) sv = MUTABLE_SV(SvRV(sv)); if (SvTYPE(sv) == SVt_REGEXP) return (REGEXP*) sv; C will be returned if a REGEXP* is not found. =over 3 REGEXP * SvRX(SV *sv) =back =back =for hackers Found in file regexp.h =over 4 =item C X Returns a boolean indicating whether the SV (or the one it references) is a REGEXP. If you want to do something with the REGEXP* later use SvRX instead and check for NULL. =over 3 bool SvRXOK(SV* sv) =back =back =for hackers Found in file regexp.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlreapi.pod =head1 Reports and Formats These are used in the simple report generation feature of Perl. See L. =over 4 =item C Described in L. =over 3 GV * IoBOTTOM_GV(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 char * IoBOTTOM_NAME(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 GV * IoFMT_GV(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 char * IoFMT_NAME(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 IV IoLINES(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 IV IoLINES_LEFT(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 IV IoPAGE(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 IV IoPAGE_LEN(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 GV * IoTOP_GV(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =over 3 char * IoTOP_NAME(IO *io) =back =back =for hackers Found in file pod/perlguts.pod =head1 Signals =over 4 =item C X This symbol, if defined, indicates that C has the C member =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C has the C member =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C has the C member =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C has the C member =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C has the C member =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C has the C member =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C has the C member =back =for hackers Found in file config.h =over 4 =item C X If this bit in C is set, the system is uing the pre-Perl 5.8 unsafe signals. See L and L. =over 3 U32 PERL_SIGNALS_UNSAFE_FLAG =back =back =for hackers Found in file perl.h =over 4 =item C X A wrapper for the C library functions L or L. Use this instead of those libc functions, as the Perl version gives the safest available implementation, and knows things that interact with the rest of the perl interpreter. =over 3 Sighandler_t rsignal(int i, Sighandler_t t) =back =back =for hackers Found in file util.c =over 4 =item C X Returns a the current signal handler for signal C. See L>. =over 3 Sighandler_t rsignal_state(int i) =back =back =for hackers Found in file util.c =over 4 =item C X This is the buffer type to be used with Sigsetjmp and Siglongjmp. =back =for hackers Found in file config.h =over 4 =item C X This macro is used in the same way as C, but will invoke traditional C if siglongjmp isn't available. See C>. =over 3 void Siglongjmp(jmp_buf env, int val) =back =back =for hackers Found in file handy.h =over 4 =item C X This symbol contains a list of signal names in order of signal number. This is intended to be used as a static array initialization, like this: char *sig_name[] = { SIG_NAME }; The signals in the list are separated with commas, and each signal is surrounded by double quotes. There is no leading C in the signal name, i.e. C is known as "C". Gaps in the signal numbers (up to C) are filled in with C, etc., where nn is the actual signal number (e.g. C). The signal number for C is stored in C. The last element is 0 to terminate the list with a C. This corresponds to the 0 at the end of the C list. Note that this variable is initialized from the C, not from C (which is unused). =back =for hackers Found in file config.h =over 4 =item C X This symbol contains a list of signal numbers, in the same order as the C list. It is suitable for static array initialization, as in: int sig_num[] = { SIG_NUM }; The signals in the list are separated with commas, and the indices within that list and the C list match, so it's easy to compute the signal name from a number or vice versa at the price of a small dynamic linear lookup. Duplicates are allowed, but are moved to the end of the list. The signal number corresponding to C is C. if (i < C) then C == i. The last element is 0, corresponding to the 0 at the end of the C list. Note that this variable is initialized from the C, not from C (which is unused). =back =for hackers Found in file config.h =over 4 =item C X This macro is used in the same way as C, but will invoke traditional C if sigsetjmp isn't available. See C>. =over 3 int Sigsetjmp(jmp_buf env, int savesigs) =back =back =for hackers Found in file handy.h =over 4 =item C X This variable contains the number of elements of the C and C arrays, excluding the final C entry. =back =for hackers Found in file config.h =over 4 =item C =item C =item C =item C XXXX These all convert a signal name into its corresponding signal number; returning -1 if no corresponding number was found. They differ only in the source of the signal name: C takes the name from the C-terminated string starting at C. C is merely a different spelling, a synonym, of C. C takes the name from the string starting at C, with length C bytes. C takes the name from the PV stored in the SV C. =over 3 I32 whichsig (const char *sig) I32 whichsig_pv (const char *sig) I32 whichsig_pvn(const char *sig, STRLEN len) I32 whichsig_sv (SV *sigsv) =back =back =for hackers Found in file mg.c =head1 Site configuration These variables give details as to where various libraries, installation destinations, I, go, as well as what various installation options were selected =over 4 =item C X This variable, if defined, holds the name of the directory in which the user wants to put architecture-dependent public library files for perl5. It is most often a local directory such as F. Programs using this variable must be prepared to deal with filename expansion. If C is the same as C, it is not defined, since presumably the program already searches C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the ~name expanded version of C, to be used in programs that are not prepared to deal with ~ expansion at run-time. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds a string representing the architecture name. It may be used to construct an architecture-dependant pathname where library files may be held under a private library, for instance. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the path of the bin directory where the package will be installed. Program must be prepared to deal with ~name substitution. =back =for hackers Found in file config.h =over 4 =item C X This symbol is the filename expanded version of the C symbol, for programs that do not want to deal with that at run-time. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl is to be installed also as F. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, signifies that the build process will produce some binary files that are going to be used in a cross-platform environment. This is the case for example with the NeXT "fat" binaries that contain executables for several C. =back =for hackers Found in file config.h =over 4 =item C X This variable specifies the list of subdirectories in over which F:C and F will automatically search when adding directories to @C, in a format suitable for a C initialization string. See the C entry in Porting/Glossary for more details. =back =for hackers Found in file config.h =over 4 =item C X This variable contains a colon-separated set of paths for the perl binary to search for additional library files or modules. These directories will be tacked to the end of @C. Perl will automatically search below each path for version- and architecture-specific directories. See C> for more details. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that we'd like to relocate entries in @C at run time based on the location of the perl binary. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates the target architecture Perl has been cross-compiled to. Undefined if not a cross-compile. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl was configured with C<-Dusedevel>, to enable development features. This should not be done for production builds. =back =for hackers Found in file config.h =over 4 =item C X If defined, this symbol contains the name of a private library. The library is private in the sense that it needn't be in anyone's execution path, but it should be accessible by the world. It may have a ~ on the front. The standard distribution will put nothing in this directory. Vendors who distribute perl may wish to place their own architecture-dependent modules and extensions in this directory with MakeMaker Makefile.PL INSTALLDIRS=vendor or equivalent. See C> for details. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the ~name expanded version of C, to be used in programs that are not prepared to deal with ~ expansion at run-time. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the ~name expanded version of C, to be used in programs that are not prepared to deal with ~ expansion at run-time. =back =for hackers Found in file config.h =over 4 =item C X This define is C with any trailing version-specific component removed. The elements in C (C.U (part of metaconfig)) can be tacked onto this variable to generate a list of directories to search. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the name of the private library for this package. The library is private in the sense that it needn't be in anyone's execution path, but it should be accessible by the world. The program should be prepared to do ~ expansion. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the ~name expanded version of C, to be used in programs that are not prepared to deal with ~ expansion at run-time. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the name of the private library for this package. The library is private in the sense that it needn't be in anyone's execution path, but it should be accessible by the world. The program should be prepared to do ~ expansion. The standard distribution will put nothing in this directory. After perl has been installed, users may install their own local architecture-dependent modules in this directory with MakeMaker Makefile.PL or equivalent. See C> for details. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the ~name expanded version of C, to be used in programs that are not prepared to deal with ~ expansion at run-time. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the name of the private library for this package. The library is private in the sense that it needn't be in anyone's execution path, but it should be accessible by the world. The program should be prepared to do ~ expansion. The standard distribution will put nothing in this directory. After perl has been installed, users may install their own local architecture-independent modules in this directory with MakeMaker Makefile.PL or equivalent. See C> for details. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the ~name expanded version of C, to be used in programs that are not prepared to deal with ~ expansion at run-time. =back =for hackers Found in file config.h =over 4 =item C X This define is C with any trailing version-specific component removed. The elements in C (C.U (part of metaconfig)) can be tacked onto this variable to generate a list of directories to search. =back =for hackers Found in file config.h =over 4 =item C X This variable contains the string to put in front of a perl script to make sure (one hopes) that it runs with perl and not some shell. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that 64-bit integers should be used when available. If not defined, the native integers will be used (be they 32 or 64 bits). The maximal possible 64-bitness is employed: LP64 or C, meaning that you will be able to use more than 2 gigabytes of memory. This mode is even more binary incompatible than C. You may not be able to run the resulting executable in a 32-bit C at all or you may need at least to reboot your OS to 64-bit mode. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that 64-bit integers should be used when available. If not defined, the native integers will be employed (be they 32 or 64 bits). The minimal possible 64-bitness is used, just enough to get 64-bit integers into Perl. This may mean using for example "long longs", while your memory may still be limited to 2 gigabytes. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that getpgrp needs one arguments whereas C one needs none. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that setpgrp needs two arguments whereas C one needs none. See also C> for a C interface. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl should be built with support for backtrace. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that a C++ compiler was used to compiled Perl and will be used to compile extensions. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl is being cross-compiled. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl should be built with support for DTrace. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that dynamic loading of some sort is available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl should be built to use 'fast stdio'. Defaults to define in Perls 5.8 and earlier, to undef later. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl should be built to use the interpreter-based threading implementation. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that we can use sysctl with C to get a full path for the executable, and hence convert $^X to an absolute path. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that large file support should be used when available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that long doubles should be used when available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that 64-bit interfaces and long doubles should be used when available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that we can use C<_NSGetExecutablePath> and realpath to get a full path for the executable, and hence convert $^X to an absolute path. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the PerlIO abstraction should be used throughout. If not defined, stdio should be used in a fully backward compatible manner. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the quadmath library should be used when available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl should try to use the various C<_r> versions of library functions. This is extremely experimental. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C * is used for semctl C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that C is used for semctl C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that sitecustomize should be used. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl should be built to use socks. =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if this system has a stat structure declaring C and C. =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if the C<_base> field (or similar) of the stdio C structure can be used to access the stdio buffer for a file handle. If this is defined, then the C macro will also be defined and should be used to access this field. Also, the C macro will be defined and should be used to determine the number of bytes in the buffer. C will never be defined unless C is. =back =for hackers Found in file config.h =over 4 =item C X This symbol is defined if the C<_ptr> and C<_cnt> fields (or similar) of the stdio C structure can be used to access the stdio buffer for a file handle. If this is defined, then the C and C macros will also be defined and should be used to access these fields. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, enables additional defaults. At this time it only enables implicit strict by default. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that Perl should be built to use threads. At present, it is a synonym for and C, but eventually the source ought to be changed to use this to mean C<_any_> threading implementation. =back =for hackers Found in file config.h =head1 Sockets configuration values =over 4 =item C X This symbol, if defined, indicates the availability of C; =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C structure has a member called C, indicating the length of the structure. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates the availability of C; =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to test whether a socket is at the out-of-band mark. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C C interface is supported. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C C call is supported. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to initialize C 5. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that F exists and should be included. =over 3 #ifdef I_SOCKS #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates the F should be included to get socket ioctl options, like C. =over 3 #ifdef I_SYS_SOCKIO #include #endif =back =back =for hackers Found in file config.h =head1 Source Filters =over 4 =item C X Given an OP_LIST containing attribute definitions, filter it for known builtin attributes to apply to the cv, returning a possibly-smaller list containing just the remaining ones. =over 3 OP * apply_builtin_cv_attributes(CV *cv, OP *attrlist) =back =back =for hackers Found in file toke.c =over 4 =item C Described in L. =over 3 SV * filter_add(filter_t funcp, SV *datasv) =back =back =for hackers Found in file pod/perlfilter.pod =over 4 =item C X Delete most recently added instance of the filter function argument =over 3 void filter_del(filter_t funcp) =back =back =for hackers Found in file toke.c =over 4 =item C Described in L. =over 3 I32 filter_read(int idx, SV *buf_sv, int maxlen) =back =back =for hackers Found in file pod/perlfilter.pod =over 4 =item C X Returns a pointer to the next character after the parsed vstring, as well as updating the passed in sv. Function must be called like sv = sv_2mortal(newSV(5)); s = scan_vstring(s,e,sv); where s and e are the start and end of the string. The sv should already be large enough to store the vstring passed in, for performance reasons. This function may croak if fatal warnings are enabled in the calling scope, hence the sv_2mortal in the example (to prevent a leak). Make sure to do SvREFCNT_inc afterwards if you use sv_2mortal. =over 3 char * scan_vstring(const char *s, const char * const e, SV *sv) =back =back =for hackers Found in file toke.c =over 4 =item C X Set things up for parsing a subroutine. If C is non-zero, the input is to be considered a format sub (a specialised sub used to implement perl's C feature); else a normal C. C are added to the flags for C. C may include the C bit, which causes the new subroutine to be a method. This returns the value of C that was in effect upon entry to the function; =over 3 I32 start_subparse(I32 is_format, U32 flags) =back =back =for hackers Found in file toke.c =head1 Stack Manipulation Macros =over 4 =item C X Declare a stack marker variable, C, for the XSUB. See C> and C>. =over 3 dMARK; =back =back =for hackers Found in file pp.h =over 4 =item C X Saves the original stack mark for the XSUB. See C>. =over 3 dORIGMARK; =back =back =for hackers Found in file pp.h =over 4 =item C X Declares a local copy of perl's stack pointer for the XSUB, available via the C macro. See C>. =over 3 dSP; =back =back =for hackers Found in file pp.h =over 4 =item C X Declare that this function uses C, and initializes it =over 3 dTARGET; =back =back =for hackers Found in file pp.h =over 4 =item C X Used to extend the argument stack for an XSUB's return values. Once used, guarantees that there is room for at least C to be pushed onto the stack. =over 3 void EXTEND(SP, SSize_t nitems) =back =back =for hackers Found in file pp.h =over 4 =item C X Stack marker variable for the XSUB. See C>. =back =for hackers Found in file pp.h =over 4 =item C X Push an integer onto the stack. The stack must have room for this element. Does not use C. See also C>, C> and C>. =over 3 void mPUSHi(IV iv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push a double onto the stack. The stack must have room for this element. Does not use C. See also C>, C> and C>. =over 3 void mPUSHn(NV nv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push a string onto the stack. The stack must have room for this element. The C indicates the length of the string. Does not use C. See also C>, C> and C>. =over 3 void mPUSHp(char* str, STRLEN len) =back =back =for hackers Found in file pp.h =over 4 =item C X A variation on C that takes a literal string and calculates its size directly. =over 3 void mPUSHpvs("literal string") =back =back =for hackers Found in file pp.h =over 4 =item C X Push an SV onto the stack and mortalizes the SV. The stack must have room for this element. Does not use C. See also C> and C>. =over 3 void mPUSHs(SV* sv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push an unsigned integer onto the stack. The stack must have room for this element. Does not use C. See also C>, C> and C>. =over 3 void mPUSHu(UV uv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push an integer onto the stack, extending the stack if necessary. Does not use C. See also C>, C> and C>. =over 3 void mXPUSHi(IV iv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push a double onto the stack, extending the stack if necessary. Does not use C. See also C>, C> and C>. =over 3 void mXPUSHn(NV nv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push a string onto the stack, extending the stack if necessary. The C indicates the length of the string. Does not use C. See also C>, C and C. =over 3 void mXPUSHp(char* str, STRLEN len) =back =back =for hackers Found in file pp.h =over 4 =item C X A variation on C that takes a literal string and calculates its size directly. =over 3 void mXPUSHpvs("literal string") =back =back =for hackers Found in file pp.h =over 4 =item C X Push an SV onto the stack, extending the stack if necessary and mortalizes the SV. Does not use C. See also C> and C>. =over 3 void mXPUSHs(SV* sv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push an unsigned integer onto the stack, extending the stack if necessary. Does not use C. See also C>, C> and C>. =over 3 void mXPUSHu(UV uv) =back =back =for hackers Found in file pp.h =over 4 =item C X Used by C to hook up XSUBs as Perl subs. Adds Perl prototypes to the subs. =back =for hackers Found in file XSUB.h =over 4 =item C X The original stack mark for the XSUB. See C>. =back =for hackers Found in file pp.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Pops an integer off the stack. =over 3 IV POPi =back =back =for hackers Found in file pp.h =over 4 =item C X Pops a long off the stack. =over 3 long POPl =back =back =for hackers Found in file pp.h =over 4 =item C X Pops a double off the stack. =over 3 NV POPn =back =back =for hackers Found in file pp.h =over 4 =item C X Pops a string off the stack. =over 3 char* POPp =back =back =for hackers Found in file pp.h =over 4 =item C X Pops a string off the stack which must consist of bytes i.e. characters < 256. =over 3 char* POPpbytex =back =back =for hackers Found in file pp.h =over 4 =item C X Pops a string off the stack. Identical to POPp. There are two names for historical reasons. =over 3 char* POPpx =back =back =for hackers Found in file pp.h =over 4 =item C X Pops an SV off the stack. =over 3 SV* POPs =back =back =for hackers Found in file pp.h =over 4 =item C X Pops an unsigned integer off the stack. =over 3 UV POPu =back =back =for hackers Found in file pp.h =over 4 =item C X Pops an unsigned long off the stack. =over 3 long POPul =back =back =for hackers Found in file pp.h =over 4 =item C X Push an integer onto the stack. The stack must have room for this element. Handles 'set' magic. Uses C, so C or C should be called to declare it. Do not call multiple C-oriented macros to return lists from XSUB's - see C> instead. See also C> and C>. =over 3 void PUSHi(IV iv) =back =back =for hackers Found in file pp.h =over 4 =item C X Opening bracket for arguments on a callback. See C> and L. =over 3 void PUSHMARK(SP) =back =back =for hackers Found in file pp.h =over 4 =item C X Push a new mortal SV onto the stack. The stack must have room for this element. Does not use C. See also C>, C> and C>. =over 3 void PUSHmortal =back =back =for hackers Found in file pp.h =over 4 =item C X Push a double onto the stack. The stack must have room for this element. Handles 'set' magic. Uses C, so C or C should be called to declare it. Do not call multiple C-oriented macros to return lists from XSUB's - see C> instead. See also C> and C>. =over 3 void PUSHn(NV nv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push a string onto the stack. The stack must have room for this element. The C indicates the length of the string. Handles 'set' magic. Uses C, so C or C should be called to declare it. Do not call multiple C-oriented macros to return lists from XSUB's - see C> instead. See also C> and C>. =over 3 void PUSHp(char* str, STRLEN len) =back =back =for hackers Found in file pp.h =over 4 =item C X A variation on C that takes a literal string and calculates its size directly. =over 3 void PUSHpvs("literal string") =back =back =for hackers Found in file pp.h =over 4 =item C X Push an SV onto the stack. The stack must have room for this element. Does not handle 'set' magic. Does not use C. See also C>, C>, and C>. =over 3 void PUSHs(SV* sv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push an unsigned integer onto the stack. The stack must have room for this element. Handles 'set' magic. Uses C, so C or C should be called to declare it. Do not call multiple C-oriented macros to return lists from XSUB's - see C> instead. See also C> and C>. =over 3 void PUSHu(UV uv) =back =back =for hackers Found in file pp.h =over 4 =item C X Closing bracket for XSUB arguments. This is usually handled by C. See C> and L for other uses. =over 3 PUTBACK; =back =back =for hackers Found in file pp.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Stack pointer. This is usually handled by C. See C> and C. =back =for hackers Found in file pp.h =over 4 =item C X Refetch the stack pointer. Used after a callback. See L. =over 3 SPAGAIN; =back =back =for hackers Found in file pp.h =over 4 =item C =item C =item C =item C XXXX These temporarily allocates data on the savestack, returning an SSize_t index into the savestack, because a pointer would get broken if the savestack is moved on reallocation. Use L> to convert the returned index into a pointer. The forms differ in that plain C allocates C bytes; C and C allocate C objects, each of which is type C; and and C make sure to align the new data to an C boundary. The most useful value for the alignment is likely to be L>. The alignment will be preserved through savestack reallocation B if realloc returns data aligned to a size divisible by "align"! =over 3 SSize_t SSNEW (Size_t size) SSize_t SSNEWa (Size_t_size, Size_t align) SSize_t SSNEWat(Size_t_size, type, Size_t align) SSize_t SSNEWt (Size_t size, type) =back =back =for hackers Found in file scope.h =over 4 =item C =item C XX These convert the C returned by L/> and kin into actual pointers. The difference is that C casts the result to C, and C casts it to a pointer of that C. =over 3 type SSPTR (SSize_t index, type) type * SSPTRt(SSize_t index, type) =back =back =for hackers Found in file scope.h =over 4 =item C X C is short for "target". It is an entry in the pad that an OPs C refers to. It is scratchpad space, often used as a return value for the OP, but some use it for other purposes. =over 3 TARG; =back =back =for hackers Found in file pp.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Push an integer onto the stack, extending the stack if necessary. Handles 'set' magic. Uses C, so C or C should be called to declare it. Do not call multiple C-oriented macros to return lists from XSUB's - see C> instead. See also C> and C>. =over 3 void XPUSHi(IV iv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push a new mortal SV onto the stack, extending the stack if necessary. Does not use C. See also C>, C> and C>. =over 3 void XPUSHmortal =back =back =for hackers Found in file pp.h =over 4 =item C X Push a double onto the stack, extending the stack if necessary. Handles 'set' magic. Uses C, so C or C should be called to declare it. Do not call multiple C-oriented macros to return lists from XSUB's - see C> instead. See also C> and C>. =over 3 void XPUSHn(NV nv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push a string onto the stack, extending the stack if necessary. The C indicates the length of the string. Handles 'set' magic. Uses C, so C or C should be called to declare it. Do not call multiple C-oriented macros to return lists from XSUB's - see C> instead. See also C> and C>. =over 3 void XPUSHp(char* str, STRLEN len) =back =back =for hackers Found in file pp.h =over 4 =item C X A variation on C that takes a literal string and calculates its size directly. =over 3 void XPUSHpvs("literal string") =back =back =for hackers Found in file pp.h =over 4 =item C X Push an SV onto the stack, extending the stack if necessary. Does not handle 'set' magic. Does not use C. See also C>, C and C. =over 3 void XPUSHs(SV* sv) =back =back =for hackers Found in file pp.h =over 4 =item C X Push an unsigned integer onto the stack, extending the stack if necessary. Handles 'set' magic. Uses C, so C or C should be called to declare it. Do not call multiple C-oriented macros to return lists from XSUB's - see C> instead. See also C> and C>. =over 3 void XPUSHu(UV uv) =back =back =for hackers Found in file pp.h =over 4 =item C X Macro to verify that the perl api version an XS module has been compiled against matches the api version of the perl interpreter it's being loaded into. =over 3 XS_APIVERSION_BOOTCHECK; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Return from XSUB, indicating number of items on the stack. This is usually handled by C. =over 3 void XSRETURN(int nitems) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Return an empty list from an XSUB immediately. =over 3 XSRETURN_EMPTY; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Return an integer from an XSUB immediately. Uses C. =over 3 void XSRETURN_IV(IV iv) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Return C<&PL_sv_no> from an XSUB immediately. Uses C. =over 3 XSRETURN_NO; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Return a double from an XSUB immediately. Uses C. =over 3 void XSRETURN_NV(NV nv) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Return a copy of a string from an XSUB immediately. Uses C. =over 3 void XSRETURN_PV(char* str) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Return C<&PL_sv_undef> from an XSUB immediately. Uses C. =over 3 XSRETURN_UNDEF; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Return an integer from an XSUB immediately. Uses C. =over 3 void XSRETURN_UV(IV uv) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Return C<&PL_sv_yes> from an XSUB immediately. Uses C. =over 3 XSRETURN_YES; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Place an integer into the specified position C on the stack. The value is stored in a new mortal SV. =over 3 void XST_mIV(int pos, IV iv) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Place C<&PL_sv_no> into the specified position C on the stack. =over 3 void XST_mNO(int pos) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Place a double into the specified position C on the stack. The value is stored in a new mortal SV. =over 3 void XST_mNV(int pos, NV nv) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Place a copy of a string into the specified position C on the stack. The value is stored in a new mortal SV. =over 3 void XST_mPV(int pos, char* str) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Place C<&PL_sv_undef> into the specified position C on the stack. =over 3 void XST_mUNDEF(int pos) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Place an unsigned integer into the specified position C on the stack. The value is stored in a new mortal SV. =over 3 void XST_mUV(int pos, UV uv) =back =back =for hackers Found in file XSUB.h =over 4 =item C X Place C<&PL_sv_yes> into the specified position C on the stack. =over 3 void XST_mYES(int pos) =back =back =for hackers Found in file XSUB.h =over 4 =item C X The version identifier for an XS module. This is usually handled automatically by C. See C>. =back =for hackers Found in file XSUB.h =over 4 =item C X Macro to verify that a PM module's C<$VERSION> variable matches the XS module's C variable. This is usually handled automatically by C. See L. =over 3 XS_VERSION_BOOTCHECK; =back =back =for hackers Found in file XSUB.h =head1 String Handling See also C>. =over 4 =item C X This macro concatenates 2 tokens together. =over 3 token CAT2(token x, token y) =back =back =for hackers Found in file handy.h =over 4 =item C =item C XX 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>. C is like C but returns C. Useful for encouraging compilers to tail-call optimise. =over 3 void Copy (void* src, void* dest, int nitems, type) void * CopyD(void* src, void* dest, int nitems, type) =back =back =for hackers Found in file handy.h =over 4 =item C X Copy a source buffer to a destination buffer, stopping at (but not including) the first occurrence in the source of an unescaped (defined below) delimiter byte, C. The source is the bytes between S and C - 1>. Similarly, the dest is C up to C. The number of bytes copied is written to C<*retlen>. Returns the position of the first uncopied C in the C buffer, but if there is no such occurrence before C, then C is returned, and the entire buffer S .. C - 1> is copied. If there is room in the destination available after the copy, an extra terminating safety C byte is appended (not included in the returned length). The error case is if the destination buffer is not large enough to accommodate everything that should be copied. In this situation, a value larger than S - C> is written to C<*retlen>, and as much of the source as fits will be written to the destination. Not having room for the safety C is not considered an error. In the following examples, let C be the delimiter, and C<0> represent a C byte (B the digit C<0>). Then we would have Source Destination abcxdef abc0 provided the destination buffer is at least 4 bytes long. An escaped delimiter is one which is immediately preceded by a single backslash. Escaped delimiters are copied, and the copy continues past the delimiter; the backslash is not copied: Source Destination abc\xdef abcxdef0 (provided the destination buffer is at least 8 bytes long). It's actually somewhat more complicated than that. A sequence of any odd number of backslashes escapes the following delimiter, and the copy continues with exactly one of the backslashes stripped. Source Destination abc\xdef abcxdef0 abc\\\xdef abc\\xdef0 abc\\\\\xdef abc\\\\xdef0 (as always, if the destination is large enough) An even number of preceding backslashes does not escape the delimiter, so that the copy stops just before it, and includes all the backslashes (no stripping; zero is considered even): Source Destination abcxdef abc0 abc\\xdef abc\\0 abc\\\\xdef abc\\\\0 =over 3 char * delimcpy(char *to, const char *to_end, const char *from, const char *from_end, const int delim, I32 *retlen) =back =back =for hackers Found in file util.c =over 4 =item C X This performs a Perl L|perlfunc/join>, placing the joined output into C. The elements to join are in SVs, stored in a C array of pointers to SVs, from C<**mark> to S>. Hence C<*mark> is a reference to the first SV. Each SV will be coerced into a PV if not one already. C contains the string (or coerced into a string) that is to separate each of the joined elements. If any component is in UTF-8, the result will be as well, and all non-UTF-8 components will be converted to UTF-8 as necessary. Magic and tainting are handled. =over 3 void do_join(SV *sv, SV *delim, SV **mark, SV **sp) =back =back =for hackers Found in file doop.c =over 4 =item C X This performs a Perl L|perlfunc/sprintf> placing the string output into C. The elements to format are in SVs, stored in a C array of pointers to SVs of length C> and beginning at C<**sarg>. The element referenced by C<*sarg> is the format. Magic and tainting are handled. =over 3 void do_sprintf(SV *sv, SSize_t len, SV **sarg) =back =back =for hackers Found in file doop.c =over 4 =item C X Analyzes the string in order to make fast searches on it using C -- the Boyer-Moore algorithm. =over 3 void fbm_compile(SV *sv, U32 flags) =back =back =for hackers Found in file util.c =over 4 =item C X Returns the location of the SV in the string delimited by C and C (C) is the char following the last char). It returns C if the string can't be found. The C does not have to be C, but the search will not be as fast then. =over 3 char * fbm_instr(unsigned char *big, unsigned char *bigend, SV *littlestr, U32 flags) =back =back =for hackers Found in file util.c =over 4 =item C X Returns true if the leading C bytes of the strings C and C 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. =over 3 I32 foldEQ(const char *a, const char *b, I32 len) =back =back =for hackers Found in file inline.h =over 4 =item C X This is a synonym for S> =over 3 I32 ibcmp(const char *a, const char *b, I32 len) =back =back =for hackers Found in file util.h =over 4 =item C X This is a synonym for S> =over 3 I32 ibcmp_locale(const char *a, const char *b, I32 len) =back =back =for hackers Found in file util.h =over 4 =item C X This is a synonym for S> =over 3 I32 ibcmp_utf8(const char *s1, char **pe1, UV l1, bool u1, const char *s2, char **pe2, UV l2, bool u2) =back =back =for hackers Found in file util.h =over 4 =item C X Same as L, which finds and returns a pointer to the first occurrence of the NUL-terminated substring C in the NUL-terminated string C, returning NULL if not found. The terminating NUL bytes are not compared. =over 3 char * instr(const char *big, const char *little) =back =back =for hackers Found in file util.h =over 4 =item C X Returns the position of the first occurrence of the byte C in the literal string C<"list">, or NULL if C doesn't appear in C<"list">. All bytes are treated as unsigned char. Thus this macro can be used to determine if C is in a set of particular characters. Unlike L, it works even if C is C (and the set doesn't include C). =over 3 bool memCHRs("list", char c) =back =back =for hackers Found in file handy.h =over 4 =item C X Test two buffers (which may contain embedded C characters, to see if they are equal. The C parameter indicates the number of bytes to compare. Returns true or false. It is undefined behavior if either of the buffers doesn't contain at least C bytes. =over 3 bool memEQ(char* s1, char* s2, STRLEN len) =back =back =for hackers Found in file handy.h =over 4 =item C X Like L, but the second string is a literal enclosed in double quotes, C gives the number of bytes in C. Returns true or false. =over 3 bool memEQs(char* s1, STRLEN l1, "s2") =back =back =for hackers Found in file handy.h =over 4 =item C X Test two buffers (which may contain embedded C characters, to see if they are not equal. The C parameter indicates the number of bytes to compare. Returns true or false. It is undefined behavior if either of the buffers doesn't contain at least C bytes. =over 3 bool memNE(char* s1, char* s2, STRLEN len) =back =back =for hackers Found in file handy.h =over 4 =item C X Like L, but the second string is a literal enclosed in double quotes, C gives the number of bytes in C. Returns true or false. =over 3 bool memNEs(char* s1, STRLEN l1, "s2") =back =back =for hackers Found in file handy.h =over 4 =item C =item C XX 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>. C is like C but returns C. Useful for encouraging compilers to tail-call optimise. =over 3 void Move (void* src, void* dest, int nitems, type) void * MoveD(void* src, void* dest, int nitems, type) =back =back =for hackers Found in file handy.h =over 4 =item C 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. =over 3 int my_snprintf(char *buffer, const Size_t len, const char *format, ...) =back =back =for hackers Found in file util.c =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Do NOT use this due to the possibility of overflowing C. Instead use my_snprintf() =over 3 int my_sprintf(NN char *buffer, NN const char *pat, ...) =back =back =for hackers Found in file perl.h =over 4 =item C X The C library C if available, or a Perl implementation of it. C computes the length of the string, up to C characters. It will never attempt to address more than C characters, making it suitable for use with strings that are not guaranteed to be NUL-terminated. =over 3 Size_t my_strnlen(const char *str, Size_t maxlen) =back =back =for hackers Found in file inline.h =over 4 =item C X The C library C if available and standards-compliant. 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. =over 3 int my_vsnprintf(char *buffer, const Size_t len, const char *format, va_list ap) =back =back =for hackers Found in file util.c =over 4 =item C X Combines Newx() and Copy() into a single macro. Dest will be allocated using Newx() and then src will be copied into it. =over 3 void NewCopy(void* src, void* dest, int nitems, type) =back =back =for hackers Found in file handy.h =over 4 =item C X Find the first (leftmost) occurrence of a sequence of bytes within another sequence. This is the Perl version of C, extended to handle arbitrary sequences, potentially containing embedded C characters (C is what the initial C in the function name stands for; some systems have an equivalent, C, but with a somewhat different API). Another way of thinking about this function is finding a needle in a haystack. C points to the first byte in the haystack. C points to one byte beyond the final byte in the haystack. C points to the first byte in the needle. C points to one byte beyond the final byte in the needle. All the parameters must be non-C. The function returns C if there is no occurrence of C within C. If C is the empty string, C is returned. Because this function operates at the byte level, and because of the inherent characteristics of UTF-8 (or UTF-EBCDIC), it will work properly if both the needle and the haystack are strings with the same UTF-8ness, but not if the UTF-8ness differs. =over 3 char * ninstr(const char *big, const char *bigend, const char *little, const char *lend) =back =back =for hackers Found in file util.c =over 4 =item C X Null character pointer. (No longer available when C is defined.) =back =for hackers Found in file handy.h =over 4 =item C X A scratch pad variable in which to store a C value. If would have been better named something like C. It is is typically used with C when one is actually planning to discard the returned length, (hence the length is "Not Applicable", which is how this variable got its name). B, if this is used in a situation where something that is using it is in a call stack with something else that is using it, this variable would get zapped, leading to hard-to-diagnose errors. It is usually more efficient to either declare a local variable and use that instead, or to use the C macro. =over 3 STRLEN PL_na =back =back =for hackers Found in file intrpvar.h =over 4 =item C X Like C>, but instead finds the final (rightmost) occurrence of a sequence of bytes within another sequence, returning C if there is no such occurrence. =over 3 char * rninstr(const char *big, const char *bigend, const char *little, const char *lend) =back =back =for hackers Found in file util.c =over 4 =item C 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, which means it may not contain embedded C characters and must have a trailing C. To prevent memory leaks, the memory allocated for the new string needs to be freed when no longer needed. This can be done with the C> function, or L|perlguts/SAVEFREEPV(p)>. On some platforms, Windows for example, all allocated memory owned by a thread is deallocated when that thread ends. So if you need that not to happen, you need to use the shared memory functions, such as C>. =over 3 char * savepv(const char *pv) =back =back =for hackers Found in file inline.h =over 4 =item C 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 C byte. The memory allocated for the new string can be freed with the C function. On some platforms, Windows for example, all allocated memory owned by a thread is deallocated when that thread ends. So if you need that not to happen, you need to use the shared memory functions, such as C>. =over 3 char * savepvn(const char *pv, Size_t len) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 char* savepvs("literal string") =back =back =for hackers Found in file handy.h =over 4 =item C X A version of C which allocates the duplicate string in memory which is shared between threads. =over 3 char * savesharedpv(const char *pv) =back =back =for hackers Found in file util.c =over 4 =item C X A version of C which allocates the duplicate string in memory which is shared between threads. (With the specific difference that a C pointer is not acceptable) =over 3 char * savesharedpvn(const char * const pv, const STRLEN len) =back =back =for hackers Found in file util.c =over 4 =item C X A version of C which allocates the duplicate string in memory which is shared between threads. =over 3 char* savesharedpvs("literal string") =back =back =for hackers Found in file handy.h =over 4 =item C X A version of C which allocates the duplicate string in memory which is shared between threads. =over 3 char * savesharedsvpv(SV *sv) =back =back =for hackers Found in file inline.h =over 4 =item C X A version of C/C which gets the string to duplicate from the passed in SV using C On some platforms, Windows for example, all allocated memory owned by a thread is deallocated when that thread ends. So if you need that not to happen, you need to use the shared memory functions, such as C>. =over 3 char * savesvpv(SV *sv) =back =back =for hackers Found in file inline.h =over 4 =item C X Test two C-terminated strings to see if they are equal. Returns true or false. =over 3 bool strEQ(char* s1, char* s2) =back =back =for hackers Found in file handy.h =over 4 =item C X Test two C-terminated strings to see if the first, C, is greater than or equal to the second, C. Returns true or false. =over 3 bool strGE(char* s1, char* s2) =back =back =for hackers Found in file handy.h =over 4 =item C X Test two C-terminated strings to see if the first, C, is greater than the second, C. Returns true or false. =over 3 bool strGT(char* s1, char* s2) =back =back =for hackers Found in file handy.h =over 4 =item C X This macro surrounds its token with double quotes. =over 3 string STRINGIFY(token x) =back =back =for hackers Found in file handy.h =over 4 =item C X Test two C-terminated strings to see if the first, C, is less than or equal to the second, C. Returns true or false. =over 3 bool strLE(char* s1, char* s2) =back =back =for hackers Found in file handy.h =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Test two C-terminated strings to see if the first, C, is less than the second, C. Returns true or false. =over 3 bool strLT(char* s1, char* s2) =back =back =for hackers Found in file handy.h =over 4 =item C X Test two C-terminated strings to see if they are different. Returns true or false. =over 3 bool strNE(char* s1, char* s2) =back =back =for hackers Found in file handy.h =over 4 =item C X Test two C-terminated 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). =over 3 bool strnEQ(char* s1, char* s2, STRLEN len) =back =back =for hackers Found in file handy.h =over 4 =item C X Test two C-terminated 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). =over 3 bool strnNE(char* s1, char* s2, STRLEN len) =back =back =for hackers Found in file handy.h =over 4 =item C X Returns two comma separated tokens of the input literal string, and its length. This is convenience macro which helps out in some API calls. Note that it can't be used as an argument to macros or functions that under some configurations might be macros, which means that it requires the full Perl_xxx(aTHX_ ...) form for any API calls where it's used. =over 3 pair STR_WITH_LEN("literal string") =back =back =for hackers Found in file handy.h =over 4 =item C =item C XX 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. C is like C but returns C. Useful for encouraging compilers to tail-call optimise. =over 3 void Zero (void* dest, int nitems, type) void * ZeroD(void* dest, int nitems, type) =back =back =for hackers Found in file handy.h =head1 SV Flags =over 4 =item C X Type flag for scalars. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for scalars. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for scalars. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for scalars. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for arrays. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for subroutines. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for formats. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for typeglobs. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for hashes. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for I/O objects. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for scalars. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for scalars. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for scalars. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for scalars. See L. =back =for hackers Found in file sv.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Type flag for object instances. See L. =back =for hackers Found in file sv.h =over 4 =item C X Type flag for regular expressions. See L. =back =for hackers Found in file sv.h =over 4 =item C X An enum of flags for Perl types. These are found in the file F in the C enum. Test these flags with the C macro. The types are: SVt_NULL SVt_IV SVt_NV SVt_RV SVt_PV SVt_PVIV SVt_PVNV SVt_PVMG SVt_INVLIST SVt_REGEXP SVt_PVGV SVt_PVLV SVt_PVAV SVt_PVHV SVt_PVCV SVt_PVFM SVt_PVIO SVt_PVOBJ These are most easily explained from the bottom up. C is for object instances of the new `use feature 'class'` kind. C is for I/O objects, C for formats, C for subroutines, C for hashes and C for arrays. All the others are scalar types, that is, things that can be bound to a C<$> variable. For these, the internal types are mostly orthogonal to types in the Perl language. Hence, checking C<< SvTYPE(sv) < SVt_PVAV >> is the best way to see whether something is a scalar. C represents a typeglob. If C, then it is a real, incoercible typeglob. If C, then it is a scalar to which a typeglob has been assigned. Assigning to it again will stop it from being a typeglob. C represents a scalar that delegates to another scalar behind the scenes. It is used, e.g., for the return value of C and for tied hash and array elements. It can hold any scalar value, including a typeglob. C is for regular expressions. C is for Perl core internal use only. C represents a "normal" scalar (not a typeglob, regular expression, or delegate). Since most scalars do not need all the internal fields of a PVMG, we save memory by allocating smaller structs when possible. All the other types are just simpler forms of C, with fewer internal fields. C can only hold undef. C can hold undef, an integer, or a reference. (C is an alias for C, which exists for backward compatibility.) C can hold undef or a double. (In builds that support headless NVs, these could also hold a reference via a suitable offset, in the same way that SVt_IV does, but this is not currently supported and seems to be a rare use case.) C can hold C, a string, or a reference. C is a superset of C and C. C is a superset of C and C. C can hold anything C can hold, but it may also be blessed or magical. =back =for hackers Found in file sv.h =head1 SV Handling XXXXXXXXXXX =over 4 =item C =item C =item C XXX The CV_FROM_REF> macros extract the C from a given reference SV and return a suitably-cast to pointer to the referenced SV. When running under C<-DDEBUGGING>, assertions are also applied that check that I is definitely a reference SV that refers to an SV of the right type. =over 3 AV * AV_FROM_REF(SV * ref) CV * CV_FROM_REF(SV * ref) HV * HV_FROM_REF(SV * ref) =back =back =for hackers Found in file handy.h =over 4 =item C X Checks if a C sv is a bool. B that it is the caller's responsibility to ensure that the sv is C before calling this. This is only useful in specialized logic like serialization code where performance is critical and the flags have already been checked to be correct. Almost always you should be using C instead. =over 3 bool BOOL_INTERNALS_sv_isbool(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Checks if a C sv is a false bool. B that it is the caller's responsibility to ensure that the sv is C before calling this. This is only useful in specialized logic like serialization code where performance is critical and the flags have already been checked to be correct. This is B what you should use to check if an SV is "false", for that you should be using C instead. =over 3 bool BOOL_INTERNALS_sv_isbool_false(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Checks if a C sv is a true bool. B that it is the caller's responsibility to ensure that the sv is C before calling this. This is only useful in specialized logic like serialization code where performance is critical and the flags have already been checked to be correct. This is B what you should use to check if an SV is "true", for that you should be using C instead. =over 3 bool BOOL_INTERNALS_sv_isbool_true(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a true SV if C is a true value, or a false SV if C is 0. See also C> and C>. =over 3 SV * boolSV(bool b) =back =back =for hackers Found in file sv.h =over 4 =item C X A specialised variant of C for emitting the usage message for xsubs croak_xs_usage(cv, "eee_yow"); works out the package name and subroutine name from C, and then calls C. Hence if C is C<&ouch::awk>, it would call C as: Perl_croak(aTHX_ "Usage: %" SVf "::%" SVf "(%s)", "ouch" "awk", "eee_yow"); =over 3 void croak_xs_usage(const CV * const cv, const char * const params) =back =back =for hackers Found in file universal.c =over 4 =item C X Returns the SV associated with C<$_> =over 3 SV * DEFSV =back =back =for hackers Found in file perl.h =over 4 =item C X Associate C with C<$_> =over 3 void DEFSV_set(SV * sv) =back =back =for hackers Found in file perl.h =over 4 =item C X Returns the SV of the specified Perl scalar. C are passed to L>. 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 C form is B. =over 3 SV * get_sv(const char *name, I32 flags) =back =back =for hackers Found in file perl.c =over 4 =item C X Returns a boolean as to whether or not C is a GV with a pointer to a GP (glob pointer). =over 3 bool isGV_with_GP(SV * sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Test if the content of an SV looks like a number (or is a number). C and C are treated as numbers (so will not issue a non-numeric warning), even if your C doesn't grok them. Get-magic is ignored. =over 3 I32 looks_like_number(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C =item C =item C =item C =item C XXXXXXX The C>() macros cast pointers to the types shown, in such a way (compiler permitting) that casting away const-ness will give a warning; e.g.: const SV *sv = ...; AV *av1 = (AV*)sv; <== BAD: the const has been silently cast away AV *av2 = MUTABLE_AV(sv); <== GOOD: it may warn C is the base macro used to derive new casts. The other already-built-in ones return pointers to what their names indicate. =over 3 AV * MUTABLE_AV (AV * p) CV * MUTABLE_CV (CV * p) GV * MUTABLE_GV (GV * p) HV * MUTABLE_HV (HV * p) IO * MUTABLE_IO (IO * p) void * MUTABLE_PTR(void * p) SV * MUTABLE_SV (SV * p) =back =back =for hackers Found in file handy.h =over 4 =item C =item C XX These are identical. They create an RV wrapper for an SV. The reference count for the original SV is incremented. =over 3 SV * newRV(SV * const sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Creates an RV wrapper for an SV. The reference count for the original SV is B incremented. =over 3 SV * newRV_noinc(SV * const tmpRef) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Creates a new SV. A non-zero C parameter indicates the number of bytes of preallocated string space the SV should have. An extra byte for a trailing C is also reserved. (C is not set for the SV even if string space is allocated.) The reference count for the new SV is set to 1. In 5.9.3, C replaces the older C 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, C (see L). The older API is still there for use in XS modules supporting older perls. =over 3 SV * newSV(const STRLEN len) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV boolean. =over 3 SV * newSVbool(const bool bool_val) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV that is a boolean false. =over 3 SV * newSV_false() =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV from the hash key structure. It will generate scalars that point to the shared string table where possible. Returns a new (undefined) SV if C is NULL. =over 3 SV * newSVhek(const HEK * const hek) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new mortal SV from the hash key structure. It will generate scalars that point to the shared string table where possible. Returns a new (undefined) SV if C is NULL. This is more efficient than using sv_2mortal(newSVhek( ... )) =over 3 SV * newSVhek_mortal(const HEK * const hek) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV and copies an integer into it. The reference count for the SV is set to 1. =over 3 SV * newSViv(const IV i) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV and copies a floating point value into it. The reference count for the SV is set to 1. =over 3 SV * newSVnv(const NV n) =back =back =for hackers Found in file sv.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Creates a new SV containing the pad name. =over 3 SV* newSVpadname(PADNAME *pn) =back =back =for hackers Found in file sv.h =over 4 =item C X Creates a new SV and copies a string (which may contain C (C<\0>) characters) into it. The reference count for the SV is set to 1. If C is zero, Perl will compute the length using C, (which means if you use this option, that C can't have embedded C characters and has to have a terminating C byte). This function can cause reliability issues if you are likely to pass in empty strings that are not null terminated, because it will run strlen on the string and potentially run past valid memory. Using L is a safer alternative for non C terminated strings. For string literals use L instead. This function will work fine for C terminated strings, but if you want to avoid the if statement on whether to call C use C instead (calling C yourself). =over 3 SV * newSVpv(const char * const s, const STRLEN len) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV and initializes it with the string formatted like C. NOTE: C must be explicitly called as C with an C parameter. =over 3 SV * Perl_newSVpvf(pTHX_ const char * const pat, ...) =back =back =for hackers Found in file sv.c =over 4 =item C X Like C> but does not take a thread context (C) parameter, so is used in situations where the caller doesn't already have the thread context. =over 3 SV * newSVpvf_nocontext(const char * const pat, ...) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV and copies a string into it, which may contain C characters (C<\0>) and other binary data. The reference count for the SV is set to 1. Note that if C is zero, Perl will create a zero length (Perl) string. You are responsible for ensuring that the source buffer is at least C bytes long. If the C argument is NULL the new SV will be undefined. =over 3 SV * newSVpvn(const char * const buffer, const STRLEN len) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV and copies a string (which may contain C (C<\0>) characters) into it. The reference count for the SV is set to 1. Note that if C is zero, Perl will create a zero length string. You are responsible for ensuring that the source string is at least C bytes long. If the C argument is NULL the new SV will be undefined. Currently the only flag bits accepted are C and C. If C is set, then C is called on the result before returning. If C is set, C is considered to be in UTF-8 and the C flag will be set on the new SV. C is a convenience wrapper for this function, defined as #define newSVpvn_utf8(s, len, u) \ newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0) =over 3 SV * newSVpvn_flags(const char * const s, const STRLEN len, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV with its C pointing to a shared string in the string table. If the string does not already exist in the table, it is created first. Turns on the C flag (or C and C in 5.16 and earlier). If the C parameter is non-zero, that value is used; otherwise the hash is computed. The string's hash can later be retrieved from the SV with the C> macro. The idea here is that as the string table is used for shared hash keys these strings will have C and hash lookup will avoid string compare. =over 3 SV * newSVpvn_share(const char *s, I32 len, U32 hash) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV and copies a string (which may contain C (C<\0>) characters) into it. If C is true, calls C on the new SV. Implemented as a wrapper around C. =over 3 SV* newSVpvn_utf8(const char* s, STRLEN len, U32 utf8) =back =back =for hackers Found in file sv.h =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 SV* newSVpvs("literal string") =back =back =for hackers Found in file handy.h =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 SV* newSVpvs_flags("literal string", U32 flags) =back =back =for hackers Found in file handy.h =over 4 =item C X Like C, but takes a C-terminated string instead of a string/length pair. =over 3 SV * newSVpv_share(const char *s, U32 hash) =back =back =for hackers Found in file sv.c =over 4 =item C X Like C, but takes a literal string instead of a string/length pair and omits the hash parameter. =over 3 SV* newSVpvs_share("literal string") =back =back =for hackers Found in file handy.h =over 4 =item C X Creates a new SV for the existing RV, C, to point to. If C is not an RV then it will be upgraded to one. If C is non-null then the new SV will be blessed in the specified package. The new SV is returned and its reference count is 1. The reference count 1 is owned by C. See also newRV_inc() and newRV_noinc() for creating a new RV properly. =over 3 SV * newSVrv(SV * const rv, const char * const classname) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C XXX These create a new SV which is an exact duplicate of the original SV (using C.) They differ only in that C performs 'get' magic; C skips any magic; and C allows you to explicitly set a C parameter. =over 3 SV * newSVsv (SV * const old) SV * newSVsv_flags(SV * const old, I32 flags) SV * newSVsv_nomg (SV * const old) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV that is a boolean true. =over 3 SV * newSV_true() =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV, of the type specified. The reference count for the new SV is set to 1. =over 3 SV * newSV_type(const svtype type) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Creates a new mortal SV, of the type specified. The reference count for the new SV is set to 1. This is equivalent to SV* sv = sv_2mortal(newSV_type()) and SV* sv = sv_newmortal(); sv_upgrade(sv, ) but should be more efficient than both of them. (Unless sv_2mortal is inlined at some point in the future.) =over 3 SV * newSV_type_mortal(const svtype type) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Creates a new SV and copies an unsigned integer into it. The reference count for the SV is set to 1. =over 3 SV * newSVuv(const UV u) =back =back =for hackers Found in file sv.c =over 4 =item C X Null SV pointer. (No longer available when C is defined.) =back =for hackers Found in file handy.h =over 4 =item C X This is the C SV. It is readonly. See C>. Always refer to this as C<&PL_sv_no>. =over 3 SV PL_sv_no =back =back =for hackers Found in file intrpvar.h =over 4 =item C X This is the C SV. It is readonly. Always refer to this as C<&PL_sv_undef>. =over 3 SV PL_sv_undef =back =back =for hackers Found in file intrpvar.h =over 4 =item C X This is the C SV. It is readonly. See C>. Always refer to this as C<&PL_sv_yes>. =over 3 SV PL_sv_yes =back =back =for hackers Found in file intrpvar.h =over 4 =item C X This readonly SV has a zero numeric value and a C<"0"> string value. It's similar to C> except for its string value. Can be used as a cheap alternative to C for example. Always refer to this as C<&PL_sv_zero>. Introduced in 5.28. =over 3 SV PL_sv_zero =back =back =for hackers Found in file intrpvar.h =over 4 =item C X Localize C<$_>. See L. =over 3 void SAVE_DEFSV =back =back =for hackers Found in file perl.h =over 4 =item C X In-place sort an array of SV pointers with the given comparison routine. Currently this always uses mergesort. See C> for a more flexible routine. =over 3 void sortsv(SV **array, size_t num_elts, SVCOMPARE_t cmp) =back =back =for hackers Found in file pp_sort.c =over 4 =item C X In-place sort an array of SV pointers with the given comparison routine, with various SORTf_* flag options. =over 3 void sortsv_flags(SV **array, size_t num_elts, SVCOMPARE_t cmp, U32 flags) =back =back =for hackers Found in file pp_sort.c =over 4 =item C Described in L. =back =for hackers Found in file pod/perlguts.pod =over 4 =item C X Returns a boolean as to whether C has overloading (active magic) enabled or not. =over 3 bool SvAMAGIC(SV * sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Indicate that C has overloading (active magic) disabled. =over 3 void SvAMAGIC_off(SV *sv) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Indicate that C has overloading (active magic) enabled. =over 3 void SvAMAGIC_on(SV *sv) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Remove any string offset. You should normally use the C macro wrapper instead. =over 3 void sv_backoff(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Blesses an SV into a specified package. The SV must be an RV. The package must be designated by its stash (see C>). The reference count of the SV is unaffected. =over 3 SV * sv_bless(SV * const sv, HV * const stash) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns a bool indicating whether the SV has the right flags set such that it is safe to call C or C or C. Currently equivalent to C or C. Serialization may want to unroll this check. If so you are strongly recommended to add code like C B calling using any of the BOOL_INTERNALS macros. =over 3 U32 SvBoolFlagsOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C =item C =item C XXXX These concatenate the C-terminated string C onto the end of the string which is in the SV. If the SV has the UTF-8 status set, then the bytes appended should be valid UTF-8. They differ only in how they handle magic: C performs both 'get' and 'set' magic. C performs only 'get' magic. C skips all magic. C has an extra C parameter which allows you to specify any combination of magic handling (using C and/or C), and to also override the UTF-8 handling. By supplying the C flag, the appended string is forced to be interpreted as UTF-8; by supplying instead the C flag, it will be interpreted as just bytes. Either the SV or the string appended will be upgraded to UTF-8 if necessary. =over 3 void sv_catpv (SV * const dsv, const char *sstr) void sv_catpv_flags(SV *dsv, const char *sstr, const I32 flags) void sv_catpv_mg (SV * const dsv, const char * const sstr) void sv_catpv_nomg (SV * const dsv, const char *sstr) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C =item C XXXX These process their arguments like C, and append the formatted output to an SV. As with C, argument reordering is not supporte when called with a non-null C-style variable argument list. If the appended data contains "wide" characters (including, but not limited to, SVs with a UTF-8 PV formatted with C<%s>, and characters >255 formatted with C<%c>), the original SV might get upgraded to UTF-8. If the original SV was UTF-8, the pattern should be valid UTF-8; if the original SV was bytes, the pattern should be too. All perform 'get' magic, but only C and C perform 'set' magic. C and C do not take a thread context (C) parameter, so are used in situations where the caller doesn't already have the thread context. NOTE: C must be explicitly called as C with an C parameter. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_sv_catpvf (pTHX_ SV * const sv, const char * const pat, ...) void Perl_sv_catpvf_mg (pTHX_ SV * const sv, const char * const pat, ...) void sv_catpvf_mg_nocontext(SV * const sv, const char * const pat, ...) void sv_catpvf_nocontext (SV * const sv, const char * const pat, ...) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C =item C XXXX These concatenate the C bytes of the string beginning at C onto the end of the string which is in C. The caller must make sure C contains at least C bytes. For all but C, the string appended is assumed to be valid UTF-8 if the SV has the UTF-8 status set, and a string of bytes otherwise. They differ in that: C performs both 'get' and 'set' magic on C. C performs only 'get' magic. C skips all magic. C has an extra C parameter which allows you to specify any combination of magic handling (using C and/or C) and to also override the UTF-8 handling. By supplying the C flag, the appended string is interpreted as plain bytes; by supplying instead the C flag, it will be interpreted as UTF-8, and the C will be upgraded to UTF-8 if necessary. C, C, and C are implemented in terms of C. =over 3 void sv_catpvn (SV *dsv, const char *sstr, STRLEN len) void sv_catpvn_flags(SV * const dsv, const char *sstr, const STRLEN len, const I32 flags) void sv_catpvn_mg (SV *dsv, const char *sstr, STRLEN len) void sv_catpvn_nomg (SV *dsv, const char *sstr, STRLEN len) =back =back =for hackers Found in file sv.c =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 void sv_catpvs(SV* sv, "literal string") =back =back =for hackers Found in file handy.h =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 void sv_catpvs_flags(SV* sv, "literal string", I32 flags) =back =back =for hackers Found in file handy.h =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 void sv_catpvs_mg(SV* sv, "literal string") =back =back =for hackers Found in file handy.h =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 void sv_catpvs_nomg(SV* sv, "literal string") =back =back =for hackers Found in file handy.h =over 4 =item C =item C =item C =item C XXXX These concatenate the string from SV C onto the end of the string in SV C. If C is null, these are no-ops; otherwise only C is modified. They differ only in what magic they perform: C performs 'get' magic on both SVs before the copy, and 'set' magic on C afterwards. C performs just 'get' magic, on both SVs. C skips all magic. C has an extra C parameter which allows you to use C and/or C to specify any combination of magic handling (although either both or neither SV will have 'get' magic applied to it.) C, C, and C are implemented in terms of C. =over 3 void sv_catsv (SV *dsv, SV *sstr) void sv_catsv_flags(SV * const dsv, SV * const sstr, const I32 flags) void sv_catsv_mg (SV *dsv, SV *sstr) void sv_catsv_nomg (SV *dsv, SV *sstr) =back =back =for hackers Found in file sv.c =over 4 =item C X Remove any encumbrances from C, that need to be taken care of before it is modifiable. For example if it is Copy on Write (COW), now is the time to make that copy. If you know that you are about to change the PV value of C, instead use L> to avoid the write that would be immediately written again. =over 3 void SV_CHECK_THINKFIRST(SV * sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Call this when you are about to replace the PV value in C, which is potentially copy-on-write. It stops any sharing with other SVs, so that no Copy on Write (COW) actually happens. This COW would be useless, as it would immediately get changed to something else. This function also removes any other encumbrances that would be problematic when changing C. =over 3 void SV_CHECK_THINKFIRST_COW_DROP(SV * sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Efficient removal of characters from the beginning of the string buffer. C, or at least C, must be true and C must be a pointer to somewhere inside the string buffer. C becomes the first character of the adjusted string. Uses the C hack. On return, only C and C among the C flags will be true. Beware: after this function returns, C and SvPVX_const(sv) may no longer refer to the same chunk of data. The unfortunate similarity of this function's name to that of Perl's C operator is strictly coincidental. This function works from the left; C works from the right. =over 3 void sv_chop(SV * const sv, const char * const ptr) =back =back =for hackers Found in file sv.c =over 4 =item C X Clear an SV: call any destructors, free up any memory used by the body, and free the body itself. The SV's head is I freed, although its type is set to all 1's so that it won't inadvertently be assumed to be live during global destruction etc. This function should only be called when C is zero. Most of the time you'll want to call C instead. =over 3 void sv_clear(SV * const orig_sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Compares the strings in two SVs. Returns -1, 0, or 1 indicating whether the string in C is less than, equal to, or greater than the string in C. Is UTF-8 and S> aware, handles get magic, and will coerce its args to strings if necessary. See also C>. =over 3 I32 sv_cmp(SV * const sv1, SV * const sv2) =back =back =for hackers Found in file sv.c =over 4 =item C X Compares the strings in two SVs. Returns -1, 0, or 1 indicating whether the string in C is less than, equal to, or greater than the string in C. Is UTF-8 and S> aware and will coerce its args to strings if necessary. If the flags has the C bit set, it handles get magic. See also C>. =over 3 I32 sv_cmp_flags(SV * const sv1, SV * const sv2, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Compares the strings in two SVs in a locale-aware manner. Is UTF-8 and S> aware, handles get magic, and will coerce its args to strings if necessary. See also C>. =over 3 I32 sv_cmp_locale(SV * const sv1, SV * const sv2) =back =back =for hackers Found in file sv.c =over 4 =item C X Compares the strings in two SVs in a locale-aware manner. Is UTF-8 and S> aware and will coerce its args to strings if necessary. If the flags contain C, it handles get magic. See also C>. =over 3 I32 sv_cmp_locale_flags(SV * const sv1, SV * const sv2, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X This calls C with the SV_GMAGIC flag. See C>. =over 3 char * sv_collxfrm(SV * const sv, STRLEN * const nxp) =back =back =for hackers Found in file sv.c =over 4 =item C X Add Collate Transform magic to an SV if it doesn't already have it. If the flags contain C, it handles get-magic. Any scalar variable may carry C magic that contains the scalar data of the variable, but transformed to such a format that a normal memory comparison can be used to compare the data according to the locale settings. =over 3 char * sv_collxfrm_flags(SV * const sv, STRLEN * const nxp, I32 const flags) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C XXX These copy a stringified representation of the source SV into the destination SV. They automatically perform coercion of numeric values into strings. Guaranteed to preserve the C flag even from overloaded objects. Similar in nature to C but they operate directly on an SV instead of just the string. Mostly they use L> to do the work, except when that would lose the UTF-8'ness of the PV. The three forms differ only in whether or not they perform 'get magic' on C. C skips 'get magic'; C performs it; and C either performs it (if the C bit is set in C) or doesn't (if that bit is cleared). =over 3 void sv_copypv (SV * const dsv, SV * const ssv) void sv_copypv_flags(SV * const dsv, SV * const ssv, const I32 flags) void sv_copypv_nomg (SV * const dsv, SV * const ssv) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns the length, in bytes, of the PV inside the SV. Note that this may not match Perl's C; for that, use C. See C> also. =over 3 STRLEN SvCUR(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Sets the current length, in bytes, of the C string which is in the SV. See C> and C>. =over 3 void SvCUR_set(SV* sv, STRLEN len) =back =back =for hackers Found in file sv.h =over 4 =item C X Using various gambits, try to get a CV from an SV; in addition, try if possible to set C<*st> and C<*gvp> to the stash and GV associated with it. The flags in C are passed to C. =over 3 CV * sv_2cv(SV *sv, HV ** const st, GV ** const gvp, const I32 lref) =back =back =for hackers Found in file sv.c =over 4 =item C =item C XX These auto-decrement the value in the SV, doing string to numeric conversion if necessary. They both handle operator overloading. They differ only in that: C handles 'get' magic; C skips 'get' magic. =over 3 void sv_dec(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Exactly like L, but doesn't take a C parameter. =over 3 bool sv_derived_from(SV *sv, const char * const name) =back =back =for hackers Found in file universal.c =over 4 =item C X Exactly like L, but takes the name string as the C of the given HV (which would presumably represent a stash). =over 3 bool sv_derived_from_hv(SV *sv, HV *hv) =back =back =for hackers Found in file universal.c =over 4 =item C X Exactly like L, but takes a nul-terminated string instead of a string/length pair. =over 3 bool sv_derived_from_pv(SV *sv, const char * const name, U32 flags) =back =back =for hackers Found in file universal.c =over 4 =item C X Returns a boolean indicating whether the SV is derived from the specified class I. To check derivation at the Perl level, call C as a normal Perl method. Currently, the only significant value for C is SVf_UTF8. =over 3 bool sv_derived_from_pvn(SV *sv, const char * const name, const STRLEN len, U32 flags) =back =back =for hackers Found in file universal.c =over 4 =item C X Exactly like L, but takes the name string in the form of an SV instead of a string/length pair. This is the advised form. =over 3 bool sv_derived_from_sv(SV *sv, SV *namesv, U32 flags) =back =back =for hackers Found in file universal.c =over 4 =item C X Like L, but doesn't take a C parameter. =over 3 bool sv_does(SV *sv, const char * const name) =back =back =for hackers Found in file universal.c =over 4 =item C X Like L, but takes a nul-terminated string instead of an SV. =over 3 bool sv_does_pv(SV *sv, const char * const name, U32 flags) =back =back =for hackers Found in file universal.c =over 4 =item C X Like L, but takes a string/length pair instead of an SV. =over 3 bool sv_does_pvn(SV *sv, const char * const name, const STRLEN len, U32 flags) =back =back =for hackers Found in file universal.c =over 4 =item C X Returns a boolean indicating whether the SV performs a specific, named role. The SV can be a Perl object or the name of a Perl class. =over 3 bool sv_does_sv(SV *sv, SV *namesv, U32 flags) =back =back =for hackers Found in file universal.c =over 4 =item C X Returns a pointer to the spot just after the last character in the string which is in the SV, where there is usually a trailing C character (even though Perl scalars do not strictly require it). See C>. Access the character as C<*(SvEND(sv))>. Warning: If C is equal to C, then C points to unallocated memory. =over 3 char* SvEND(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a boolean indicating whether the strings in the two SVs are identical. Is UTF-8 and S> aware, handles get magic, and will coerce its args to strings if necessary. This function does not handle operator overloading. For a version that does, see instead C. =over 3 I32 sv_eq(SV *sv1, SV *sv2) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns a boolean indicating whether the strings in the two SVs are identical. Is UTF-8 and S> aware and coerces its args to strings if necessary. If the flags has the C bit set, it handles get-magic, too. This function does not handle operator overloading. For a version that does, see instead C. =over 3 I32 sv_eq_flags(SV *sv1, SV *sv2, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C 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 C. See also C>. =over 3 void sv_force_normal(SV *sv) =back =back =for hackers Found in file mathoms.c =over 4 =item C X Undo various types of fakery on an SV, where fakery means "more than" a string: 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 C; if we're a copy-on-write scalar, this is the on-write time when we do the copy, and is also used locally; if this is a vstring, drop the vstring magic. If C is set then a copy-on-write scalar drops its PV buffer (if any) and becomes C rather than making a copy. (Used where this scalar is about to be set to some other value.) In addition, the C parameter gets passed to C when unreffing. C calls this function with flags set to 0. This function is expected to be used to signal to perl that this SV is about to be written to, and any extra book-keeping needs to be taken care of. Hence, it croaks on read-only values. =over 3 void sv_force_normal_flags(SV * const sv, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Decrement an SV's reference count, and if it drops to zero, call C to invoke destructors and free up any memory used by the body; finally, deallocating the SV's head itself. Normally called via a wrapper macro C. =over 3 void sv_free(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns true if the SV has get magic or overloading. If either is true then the scalar is active data, and has the potential to return a new value every time it is accessed. Hence you must be careful to only read it once per user logical operation and work with that returned value. If neither is true then the scalar's value cannot change unless written to. =over 3 U32 SvGAMAGIC(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. If C is the target of a weak reference then it returns the back references structure associated with the sv; otherwise return C. When returning a non-null result the type of the return is relevant. If it is an AV then the elements of the AV are the weak reference RVs which point at this item. If it is any other type then the item itself is the weak reference. See also C, C, C =over 3 SV * sv_get_backrefs(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Invokes C> on an SV if it has 'get' magic. For example, this will call C on a tied variable. As of 5.37.1, this function is guaranteed to evaluate its argument exactly once. =over 3 void SvGETMAGIC(SV *sv) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Get a line from the filehandle and store it into the SV, optionally appending to the currently-stored string. If C is not 0, the line is appended to the SV instead of overwriting it. C should be set to the byte offset that the appended string should start at in the SV (typically, C is a suitable choice). =over 3 char * sv_gets(SV * const sv, PerlIO * const fp, I32 append) =back =back =for hackers Found in file sv.c =over 4 =item C X Expands the character buffer in the SV so that it has room for the indicated number of bytes (remember to reserve space for an extra trailing C character). Calls C to perform the expansion if necessary. Returns a pointer to the character buffer. SV must be of type >= C. One alternative is to call C if you are not sure of the type of SV. You might mistakenly think that C is the number of bytes to add to the existing size, but instead it is the total size C should be. =over 3 char * SvGROW(SV* sv, STRLEN len) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a bool indicating whether the SV is both C and C at the same time. Equivalent to C but more efficient. =over 3 U32 SvIandPOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Unsets the PV and IV status of an SV in one operation. Equivalent to C but more efficient. =over 3 void SvIandPOK_off(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that is a string and a number in one operation. Equivalent to C but more efficient. =over 3 void SvIandPOK_on(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C XX These auto-increment the value in the SV, doing string to numeric conversion if necessary. They both handle operator overloading. They differ only in that C performs 'get' magic; C skips any magic. =over 3 void sv_inc(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Inserts and/or replaces a string at the specified offset/length within the SV. Similar to the Perl C function, with C bytes starting at C replacing C bytes of the string in C starting at C. Handles get magic. =over 3 void sv_insert(SV * const bigstr, const STRLEN offset, const STRLEN len, const char * const little, const STRLEN littlelen) =back =back =for hackers Found in file sv.c =over 4 =item C X Same as C, but the extra C are passed to the C that applies to C. =over 3 void sv_insert_flags(SV * const bigstr, const STRLEN offset, const STRLEN len, const char *little, const STRLEN littlelen, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Using various gambits, try to get an IO from an SV: the IO slot if its a GV; or the recursive result if we're an RV; or the IO slot of the symbol named after the PV if we're a string. 'Get' magic is ignored on the C passed in, but will be called on C if C is an RV. =over 3 IO * sv_2io(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns a U32 value indicating whether the SV contains an integer. =over 3 U32 SvIOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a boolean indicating whether the SV contains a signed integer. =over 3 bool SvIOK_notUV(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Unsets the IV status of an SV. =over 3 void SvIOK_off(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that it is an integer. =over 3 void SvIOK_on(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that it is an integer and disables all other C bits. =over 3 void SvIOK_only(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that it is an unsigned integer and disables all other C bits. =over 3 void SvIOK_only_UV(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a U32 value indicating whether the SV contains an integer. Checks the B setting. Use C instead. =over 3 U32 SvIOKp(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a boolean indicating whether the SV contains an integer that must be interpreted as unsigned. A non-negative integer whose value is within the range of both an IV and a UV may be flagged as either C or C. =over 3 bool SvIOK_UV(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a boolean indicating whether the SV is blessed into the specified class. This does not check for subtypes or method overloading. Use C to verify an inheritance relationship in the same way as the C operator by respecting any C method overloading; or C to test directly on the actual object type. =over 3 int sv_isa(SV *sv, const char * const name) =back =back =for hackers Found in file sv.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Returns a boolean indicating whether the SV is an object reference and is derived from the specified class, respecting any C method overloading it may have. Returns false if C is not a reference to an object, or is not derived from the specified class. This is the function used to implement the behaviour of the C operator. Does not invoke magic on C. Not to be confused with the older C function, which does not use an overloaded C method, nor will check subclassing. =over 3 bool sv_isa_sv(SV *sv, SV *namesv) =back =back =for hackers Found in file universal.c =over 4 =item C X Returns true if the SV is one of the special boolean constants (PL_sv_yes or PL_sv_no), or is a regular SV whose last assignment stored a copy of one. =over 3 bool SvIsBOOL(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a U32 value indicating whether the SV is Copy-On-Write (either shared hash key scalars, or full Copy On Write scalars if 5.9.0 is configured for COW). =over 3 U32 SvIsCOW(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a boolean indicating whether the SV is Copy-On-Write shared hash key scalar. =over 3 bool SvIsCOW_shared_hash(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a boolean indicating whether the SV is an RV pointing to a blessed object. If the SV is not an RV, or if the object is not blessed, then this will return false. =over 3 int sv_isobject(SV *sv) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C XXX These each coerce the given SV to IV and return it. The returned value in many circumstances will get stored in C's IV slot, but not in all cases. (Use C> to make sure it does). As of 5.37.1, all are guaranteed to evaluate C only once. C is now identical to C, but prior to 5.37.1, it was the only form guaranteed to evaluate C only once. C is the same as C, but does not perform 'get' magic. =over 3 IV SvIV(SV *sv) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Return the integer value of an SV, doing any necessary string conversion. If C has the C bit set, does an C first. Normally used via the C and C macros. =over 3 IV sv_2iv_flags(SV * const sv, const I32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Set the value of the IV pointer in sv to val. It is possible to perform the same function of this macro with an lvalue assignment to C. With future Perls, however, it will be more efficient to use C instead of the lvalue assignment to C. =over 3 void SvIV_set(SV* sv, IV val) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns the raw value in the SV's IV slot, without checks or conversions. Only use when you are sure C is true. See also C>. =over 3 IV SvIVX(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns the size of the string buffer in the SV, not including any part attributable to C. See C>. =over 3 STRLEN SvLEN(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns the length of the string in the SV. Handles magic and type coercion and sets the UTF8 flag appropriately. See also C>, which gives raw access to the C slot. =over 3 STRLEN sv_len(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Set the size of the string buffer for the SV. See C>. =over 3 void SvLEN_set(SV* sv, STRLEN len) =back =back =for hackers Found in file sv.h =over 4 =item C =item C XX These return the number of characters in the string in an SV, counting wide UTF-8 bytes as a single character. Both handle type coercion. They differ only in that C performs 'get' magic; C skips any magic. =over 3 STRLEN sv_len_utf8(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Arranges for a mutual exclusion lock to be obtained on C if a suitable module has been loaded. =over 3 void SvLOCK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Adds magic to an SV. First upgrades C to type C if necessary, then adds a new magic item of type C to the head of the magic list. See C> (which C now calls) for a description of the handling of the C and C arguments. You need to use C to add magic to C SVs and also to add more than one instance of the same C. =over 3 void sv_magic(SV * const sv, SV * const obj, const int how, const char * const name, const I32 namlen) =back =back =for hackers Found in file sv.c =over 4 =item C X Adds magic to an SV, upgrading it if necessary. Applies the supplied C and returns a pointer to the magic added. Note that C will allow things that C will not. In particular, you can add magic to C SVs, and add more than one instance of the same C. If C is greater than zero then a C I of C is stored, if C is zero then C is stored as-is and - as another special case - if C<(name && namlen == HEf_SVKEY)> then C is assumed to contain an SV* and is stored as-is with its C incremented. (This is now used as a subroutine by C.) =over 3 MAGIC * sv_magicext(SV * const sv, SV * const obj, const int how, const MGVTBL * const vtbl, const char * const name, const I32 namlen) =back =back =for hackers Found in file sv.c =over 4 =item C X Set the value of the MAGIC pointer in C to val. See C>. =over 3 void SvMAGIC_set(SV* sv, MAGIC* val) =back =back =for hackers Found in file sv.h =over 4 =item C X Marks an existing SV as mortal. The SV will be destroyed "soon", either by an explicit call to C, or by an implicit call at places such as statement boundaries. C is turned on which means that the SV's string buffer can be "stolen" if this SV is copied. See also C> and C>. =over 3 SV * sv_2mortal(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new SV which is a copy of the original SV (using C). The new SV is marked as mortal. It will be destroyed "soon", either by an explicit call to C, or by an implicit call at places such as statement boundaries. See also C> and C>. =over 3 SV * sv_mortalcopy(SV * const oldsv) =back =back =for hackers Found in file sv.c =over 4 =item C X Like C, but the extra C are passed to the C. =over 3 SV * sv_mortalcopy_flags(SV * const oldsv, U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Creates a new null SV which is mortal. The reference count of the SV is set to 1. It will be destroyed "soon", either by an explicit call to C, or by an implicit call at places such as statement boundaries. See also C> and C>. =over 3 SV * sv_newmortal() =back =back =for hackers Found in file sv.c =over 4 =item C X Returns a U32 value indicating whether the SV contains a number, integer or double. =over 3 U32 SvNIOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Unsets the NV/IV status of an SV. =over 3 void SvNIOK_off(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a U32 value indicating whether the SV contains a number, integer or double. Checks the B setting. Use C instead. =over 3 U32 SvNIOKp(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a U32 value indicating whether the SV contains a double. =over 3 U32 SvNOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Unsets the NV status of an SV. =over 3 void SvNOK_off(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that it is a double. =over 3 void SvNOK_on(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that it is a double and disables all other OK bits. =over 3 void SvNOK_only(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a U32 value indicating whether the SV contains a double. Checks the B setting. Use C instead. =over 3 U32 SvNOKp(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Dummy routine which "locks" an SV when there is no locking module present. Exists to avoid test for a C function pointer and because it could potentially warn under some level of strict-ness. "Superseded" by C. =over 3 void sv_nolocking(SV *sv) =back =back =for hackers Found in file mathoms.c =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Dummy routine which "unlocks" an SV when there is no locking module present. Exists to avoid test for a C function pointer and because it could potentially warn under some level of strict-ness. "Superseded" by C. =over 3 void sv_nounlocking(SV *sv) =back =back =for hackers Found in file mathoms.c =over 4 =item C X A convenient shortcut for calling C with the C flag. This function basically behaves like the Perl code C<$sv1 == $sv2>. =over 3 bool sv_numeq(SV *sv1, SV *sv2) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns a boolean indicating whether the numbers in the two SVs are identical. If the flags argument has the C bit set, it handles get-magic too. Will coerce its args to numbers if necessary. Treats C as undef. If flags does not have the C bit set, an attempt to use C<==> overloading will be made. If such overloading does not exist or the flag is set, then regular numerical comparison will be used instead. =over 3 bool sv_numeq_flags(SV *sv1, SV *sv2, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C XXX These each coerce the given SV to NV and return it. The returned value in many circumstances will get stored in C's NV slot, but not in all cases. (Use C> to make sure it does). As of 5.37.1, all are guaranteed to evaluate C only once. C is now identical to C, but prior to 5.37.1, it was the only form guaranteed to evaluate C only once. C is the same as C, but does not perform 'get' magic. =over 3 NV SvNV(SV *sv) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Return the num value of an SV, doing any necessary string or integer conversion. If C has the C bit set, does an C first. Normally used via the C and C macros. =over 3 NV sv_2nv_flags(SV * const sv, const I32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Set the value of the NV pointer in C to val. See C>. =over 3 void SvNV_set(SV* sv, NV val) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns the raw value in the SV's NV slot, without checks or conversions. Only use when you are sure C is true. See also C>. =over 3 NV SvNVX(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a U32 value indicating whether the value is defined. This is only meaningful for scalars. =over 3 U32 SvOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a U32 indicating whether the pointer to the string buffer is offset. This hack is used internally to speed up removal of characters from the beginning of a C>. When C is true, then the start of the allocated string buffer is actually C bytes before C. This offset used to be stored in C, but is now stored within the spare part of the buffer. =over 3 U32 SvOOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Remove any string offset. =over 3 void SvOOK_off(SV * sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Reads into C the offset from C back to the true start of the allocated buffer, which will be non-zero if C has been used to efficiently remove characters from start of the buffer. Implemented as a macro, which takes the address of C, which must be of type C. Evaluates C more than once. Sets C to 0 if C is false. =over 3 void SvOOK_offset(SV*sv, STRLEN len) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a U32 value indicating whether the SV contains a character string. =over 3 U32 SvPOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Unsets the PV status of an SV. =over 3 void SvPOK_off(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that it is a string. =over 3 void SvPOK_on(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that it is a string and disables all other C bits. Will also turn off the UTF-8 status. =over 3 void SvPOK_only(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that it is a string and disables all other C bits, and leaves the UTF-8 status as it was. =over 3 void SvPOK_only_UTF8(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a U32 value indicating whether the SV contains a character string. Checks the B setting. Use C instead. =over 3 U32 SvPOKp(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Converts the value pointed to by C from a count of bytes from the start of the string, to a count of the equivalent number of UTF-8 chars. Handles magic and type coercion. Use C in preference, which correctly handles strings longer than 2Gb. =over 3 void sv_pos_b2u(SV * const sv, I32 * const offsetp) =back =back =for hackers Found in file sv.c =over 4 =item C X Converts C from a count of bytes from the start of the string, to a count of the equivalent number of UTF-8 chars. Handles type coercion. C is passed to C, and usually should be C to handle magic. =over 3 STRLEN sv_pos_b2u_flags(SV * const sv, STRLEN const offset, U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Converts the value pointed to by C from a count of UTF-8 chars from the start of the string, to a count of the equivalent number of bytes; if C is non-zero, it does the same to C, but this time starting from the offset, rather than from the start of the string. Handles magic and type coercion. Use C in preference, which correctly handles strings longer than 2Gb. =over 3 void sv_pos_u2b(SV * const sv, I32 * const offsetp, I32 * const lenp) =back =back =for hackers Found in file sv.c =over 4 =item C X Converts the offset from a count of UTF-8 chars from the start of the string, to a count of the equivalent number of bytes; if C is non-zero, it does the same to C, but this time starting from C, rather than from the start of the string. Handles type coercion. C is passed to C, and usually should be C to handle magic. =over 3 STRLEN sv_pos_u2b_flags(SV * const sv, STRLEN uoffset, STRLEN * const lenp, U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXXXXXXXXXXXXXXXXXXXXXX These each return a pointer to the string in C, or a stringified form of C if it does not contain a string. The SV may cache the stringified version becoming C. This is a very basic and common operation, so there are lots of slightly different versions of it. Note that there is no guarantee that the return value of C, for example, is equal to C, or that C contains valid data, or that successive calls to C (or another of these forms) will return the same pointer value each time. This is due to the way that things like overloading and Copy-On-Write are handled. In these cases, the return value may point to a temporary buffer or similar. If you absolutely need the C field to be valid (for example, if you intend to write to it), then see C>. The differences between the forms are: The forms with neither C nor C in their names (e.g., C or C) can expose the SV's internal string buffer. If that buffer consists entirely of bytes 0-255 and includes any bytes above 127, then you B consult C to determine the actual code points the string is meant to contain. Generally speaking, it is probably safer to prefer C, C, and the like. See L for more details. The forms with C in their names allow you to use the C parameter to specify to process 'get' magic (by setting the C flag) or to skip 'get' magic (by clearing it). The other forms process 'get' magic, except for the ones with C in their names, which skip 'get' magic. The forms that take a C parameter will set that variable to the byte length of the resultant string (these are macros, so don't use C<&len>). The forms with C in their names indicate they don't have a C parameter. They should be used only when it is known that the PV is a C string, terminated by a NUL byte, and without intermediate NUL characters; or when you don't care about its length. The forms with C in their names return S> so that the compiler will hopefully complain if you were to try to modify the contents of the string (unless you cast away const yourself). The other forms return a mutable pointer so that the string is modifiable by the caller; this is emphasized for the ones with C in their names. As of 5.38, all forms are guaranteed to evaluate C exactly once. For earlier Perls, use a form whose name ends with C for single evaluation. C is like C, but converts C to UTF-8 first if not already UTF-8. Similarly, the other forms with C in their names correspond to their respective forms without. C and C don't have corresponding non-C forms. Instead they are like C, but when C is undef, they return C. C is like C, but converts C to byte representation first if currently encoded as UTF-8. If C cannot be downgraded from UTF-8, it croaks. Similarly, the other forms with C in their names correspond to their respective forms without. C doesn't have a corresponding non-C form. Instead it is like C, but when C is undef, it returns C. =over 3 char* SvPV (SV* sv, STRLEN len) const char* SvPV_const (SV* sv, STRLEN len) char* SvPV_flags (SV* sv, STRLEN len, U32 flags) const char* SvPV_flags_const (SV* sv, STRLEN len, U32 flags) char* SvPV_flags_mutable (SV* sv, STRLEN len, U32 flags) char* SvPV_mutable (SV* sv, STRLEN len) char* SvPV_nolen (SV* sv) const char* SvPV_nolen_const (SV* sv) char* SvPV_nomg (SV* sv, STRLEN len) const char* SvPV_nomg_const (SV* sv, STRLEN len) const char* SvPV_nomg_const_nolen(SV* sv) char* SvPV_nomg_nolen (SV* sv) char* SvPVbyte (SV* sv, STRLEN len) char* SvPVbyte_nolen (SV* sv) char* SvPVbyte_nomg (SV* sv, STRLEN len) char* SvPVbyte_or_null (SV* sv, STRLEN len) char* SvPVbyte_or_null_nomg(SV* sv, STRLEN len) char* SvPVbytex (SV* sv, STRLEN len) char* SvPVbytex_nolen (SV* sv) char* SvPVutf8 (SV* sv, STRLEN len) char* SvPVutf8_nolen (SV* sv) char* SvPVutf8_nomg (SV* sv, STRLEN len) char* SvPVutf8_or_null (SV* sv, STRLEN len) char* SvPVutf8_or_null_nomg(SV* sv, STRLEN len) char* SvPVutf8x (SV* sv, STRLEN len) char* SvPVx (SV* sv, STRLEN len) const char* SvPVx_const (SV* sv, STRLEN len) char* SvPVx_nolen (SV* sv) const char* SvPVx_nolen_const (SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C XX These implement the various forms of the L> macros. The macros are the preferred interface. These return a pointer to the string value of an SV (coercing it to a string if necessary), and set C<*lp> to its length in bytes. The forms differ in that plain C always processes 'get' magic; and C processes 'get' magic if and only if C contains C. =over 3 char * sv_2pv (SV *sv, STRLEN *lp) char * sv_2pv_flags(SV * const sv, STRLEN * const lp, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C =item C XX These implement the various forms of the L> macros. The macros are the preferred interface. These return a pointer to the byte-encoded representation of the SV, and set C<*lp> to its length. If the SV is marked as being encoded as UTF-8, it will be downgraded, if possible, to a byte string. If the SV cannot be downgraded, they croak. The forms differ in that plain C always processes 'get' magic; and C processes 'get' magic if and only if C contains C. =over 3 char * sv_2pvbyte (SV *sv, STRLEN * const lp) char * sv_2pvbyte_flags(SV *sv, STRLEN * const lp, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Ensures that sv is a SVt_PV and that its SvCUR is 0, and that it is properly null terminated. Equivalent to sv_setpvs(""), but more efficient. =over 3 char * SvPVCLEAR(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Like SvPVCLEAR, but optimized for newly-minted SVt_PV/PVIV/PVNV/PVMG that already have a PV buffer allocated, but no SvTHINKFIRST. =over 3 char * SvPVCLEAR_FRESH(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXXXXXXX These are like C>, returning the string in the SV, but will force the SV into containing a string (C>), and only a string (C>), by hook or by crook. You need to use one of these C routines if you are going to update the C> directly. Note that coercing an arbitrary scalar into a plain PV will potentially strip useful data from it. For example if the SV was C, then the referent will have its reference count decremented, and the SV itself may be converted to an C scalar with a string buffer containing a value such as C<"ARRAY(0x1234)">. The differences between the forms are: The forms with C in their names allow you to use the C parameter to specify to perform 'get' magic (by setting the C flag) or to skip 'get' magic (by clearing it). The other forms do perform 'get' magic, except for the ones with C in their names, which skip 'get' magic. The forms that take a C parameter will set that variable to the byte length of the resultant string (these are macros, so don't use C<&len>). The forms with C in their names indicate they don't have a C parameter. They should be used only when it is known that the PV is a C string, terminated by a NUL byte, and without intermediate NUL characters; or when you don't care about its length. The forms with C in their names are effectively the same as those without, but the name emphasizes that the string is modifiable by the caller, which it is in all the forms. C is like C, but converts C to UTF-8 first if not already UTF-8. C is like C, but guarantees to evaluate C only once; use the more efficient C otherwise. C is like C, but converts C to byte representation first if currently encoded as UTF-8. If the SV cannot be downgraded from UTF-8, this croaks. C is like C, but guarantees to evaluate C only once; use the more efficient C otherwise. =over 3 char* SvPV_force (SV* sv, STRLEN len) char* SvPV_force_flags (SV * sv, STRLEN len, U32 flags) char* SvPV_force_flags_mutable(SV * sv, STRLEN len, U32 flags) char* SvPV_force_flags_nolen (SV * sv, U32 flags) char* SvPV_force_mutable (SV * sv, STRLEN len) char* SvPV_force_nolen (SV* sv) char* SvPV_force_nomg (SV* sv, STRLEN len) char* SvPV_force_nomg_nolen (SV * sv) char* SvPVbyte_force (SV * sv, STRLEN len) char* SvPVbytex_force (SV * sv, STRLEN len) char* SvPVutf8_force (SV * sv, STRLEN len) char* SvPVutf8x_force (SV * sv, STRLEN len) char* SvPVx_force (SV* sv, STRLEN len) =back =back =for hackers Found in file sv.h =over 4 =item C X Frees the PV buffer in C, leaving things in a precarious state, so should only be used as part of a larger operation =over 3 void SvPV_free(SV * sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Get a sensible string out of the SV somehow. If C has the C bit set, will C> on C if appropriate, else not. C and C are implemented in terms of this function. You normally want to use the various wrapper macros instead: see C> and C>. =over 3 char * sv_pvn_force_flags(SV * const sv, STRLEN * const lp, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Low level micro optimization of C>. It is generally better to use C instead. This is because C ignores potential issues that C handles. C needs to have a real C that is unencumbered by things like COW. Using C or C before calling this should clean it up, but why not just use C if you're not sure about the provenance? =over 3 void SvPV_renew(SV* sv, STRLEN len) =back =back =for hackers Found in file sv.h =over 4 =item C X This is probably not what you want to use, you probably wanted L or L or L. Set the value of the PV pointer in C to the Perl allocated C-terminated string C. See also C>. Remember to free the previous PV buffer. There are many things to check. Beware that the existing pointer may be involved in copy-on-write or other mischief, so do C and use C or C (or check the C flag) first to make sure this modification is safe. Then finally, if it is not a COW, call C> to free the previous PV buffer. =over 3 void SvPV_set(SV* sv, char* val) =back =back =for hackers Found in file sv.h =over 4 =item C X Trim any trailing unused memory in the PV of C, which needs to have a real C that is unencumbered by things like COW. Think first before using this functionality. Is the space saving really worth giving up COW? Will the needed size of C stay the same? If the answers are both yes, then use L> or L> before calling this. =over 3 void SvPV_shrink_to_cur(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C XX These implement the various forms of the L> macros. The macros are the preferred interface. These return a pointer to the UTF-8-encoded representation of the SV, and set C<*lp> to its length in bytes. They may cause the SV to be upgraded to UTF-8 as a side-effect. The forms differ in that plain C always processes 'get' magic; and C processes 'get' magic if and only if C contains C. =over 3 char * sv_2pvutf8 (SV *sv, STRLEN * const lp) char * sv_2pvutf8_flags(SV *sv, STRLEN * const lp, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C =item C XXXX These return a pointer to the physical string in the SV. The SV must contain a string. Prior to 5.9.3 it is not safe to execute these unless the SV's type >= C. These are also used to store the name of an autoloaded subroutine in an XS AUTOLOAD routine. See L. C is identical to C. C is merely a synonym for C, but its name emphasizes that the string is modifiable by the caller. C differs in that the return value has been cast so that the compiler will complain if you were to try to modify the contents of the string, (unless you cast away const yourself). =over 3 char* SvPVX (SV* sv) const char* SvPVX_const (SV* sv) char* SvPVX_mutable(SV* sv) char* SvPVXx (SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a boolean as to whether or not C contains a PV that is considered TRUE. FALSE is returned if C doesn't contain a PV, or if the PV it does contain is zero length, or consists of just the single character '0'. Every other PV value is considered TRUE. As of Perl v5.37.1, C is evaluated exactly once; in earlier releases, it could be evaluated more than once. =over 3 bool SvPVXtrue(SV *sv) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Returns true if the argument is readonly, otherwise returns false. Exposed to perl code via Internals::SvREADONLY(). =over 3 U32 SvREADONLY(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Mark an object as not-readonly. Exactly what this mean depends on the object type. Exposed to perl code via Internals::SvREADONLY(). =over 3 U32 SvREADONLY_off(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Mark an object as readonly. Exactly what this means depends on the object type. Exposed to perl code via Internals::SvREADONLY(). =over 3 U32 SvREADONLY_on(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a SV describing what the SV passed in is a reference to. dst can be a SV to be set to the description or NULL, in which case a mortal SV is returned. If ob is true and the SV is blessed, the description is the class name, otherwise it is the type of the SV, "SCALAR", "ARRAY" etc. =over 3 SV * sv_ref(SV *dst, const SV * const sv, const int ob) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns the value of the object's reference count. Exposed to perl code via Internals::SvREFCNT(). =over 3 U32 SvREFCNT(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C =item C =item C XXXX These decrement the reference count of the given SV. C may only be used when C is known to not be C. The function C is identical to the C except it returns a NULL C. It is used by C which is a macro which will, when passed a non-NULL argument, decrement the reference count of its argument and then set it to NULL. You can replace code of the following form: if (sv) { SvREFCNT_dec_NN(sv); sv = NULL; } with SvREFCNT_dec_set_NULL(sv); =over 3 void SvREFCNT_dec (SV *sv) void SvREFCNT_dec_set_NULL(SV *sv) SV * SvREFCNT_dec_ret_NULL(SV *sv) void SvREFCNT_dec_NN (SV *sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C =item C =item C =item C =item C =item C =item C XXXXXXXX These all increment the reference count of the given SV. The ones without C in their names return the SV. C is the base operation; the rest are optimizations if various input constraints are known to be true; hence, all can be replaced with C. C can only be used if you know C is not C. Since we don't have to check the NULLness, it's faster and smaller. C can only be used if you don't need the return value. The macro doesn't need to return a meaningful value. C can only be used if you both don't need the return value, and you know that C is not C. The macro doesn't need to return a meaningful value, or check for NULLness, so it's smaller and faster. C can only be used with expressions without side effects. Since we don't have to store a temporary value, it's faster. C can only be used with expressions without side effects and you know C is not C. Since we don't have to store a temporary value, nor check for NULLness, it's faster and smaller. C can only be used with expressions without side effects and you don't need the return value. C can only be used with expressions without side effects, you don't need the return value, and you know C is not C. =over 3 SV * SvREFCNT_inc (SV *sv) SV * SvREFCNT_inc_NN (SV *sv) SV* SvREFCNT_inc_simple (SV* sv) SV* SvREFCNT_inc_simple_NN (SV* sv) void SvREFCNT_inc_simple_void (SV* sv) void SvREFCNT_inc_simple_void_NN(SV* sv) void SvREFCNT_inc_void (SV *sv) void SvREFCNT_inc_void_NN (SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns a string describing what the SV is a reference to. If ob is true and the SV is blessed, the string is the class name, otherwise it is the type of the SV, "SCALAR", "ARRAY" etc. =over 3 const char * sv_reftype(const SV * const sv, const int ob) =back =back =for hackers Found in file sv.c =over 4 =item C X Make the first argument a copy of the second, then delete the original. The target SV physically takes over ownership of the body of the source SV and inherits its flags; however, the target keeps any magic it owns, and any magic in the source is discarded. Note that this is a rather specialist SV copying operation; most of the time you'll want to use C or one of its many macro front-ends. =over 3 void sv_replace(SV * const sv, SV * const nsv) =back =back =for hackers Found in file sv.c =over 4 =item C X Dump the contents of all SVs not yet freed (debugging aid). =over 3 void sv_report_used() =back =back =for hackers Found in file sv.c =over 4 =item C X Underlying implementation for the C Perl function. Note that the perl-level function is vaguely deprecated. =over 3 void sv_reset(const char *s, HV * const stash) =back =back =for hackers Found in file sv.c =over 4 =item C X Tests if the SV is an RV. =over 3 U32 SvROK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Unsets the RV status of an SV. =over 3 void SvROK_off(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Tells an SV that it is an RV. =over 3 void SvROK_on(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Dereferences an RV to return the SV. =over 3 SV* SvRV(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Set the value of the RV pointer in C to val. See C>. =over 3 void SvRV_set(SV* sv, SV* val) =back =back =for hackers Found in file sv.h =over 4 =item C X Unweaken a reference: Clear the C flag on this RV; remove the backreference to this RV from the array of backreferences associated with the target SV, increment the refcount of the target. Silently ignores C and warns on non-weak references. =over 3 SV * sv_rvunweaken(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Weaken a reference: set the C flag on this RV; give the referred-to SV C magic if it hasn't already; and push a back-reference to this RV onto the array of backreferences associated with that magic. If the RV is magical, set magic will be called after the RV is cleared. Silently ignores C and warns on already-weak references. =over 3 SV * sv_rvweaken(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C =item C XX These set an SV to a true or false boolean value, upgrading first if necessary. They differ only in that C handles 'set' magic; C does not. =over 3 void sv_setbool(SV *sv, bool b) =back =back =for hackers Found in file sv.h =over 4 =item C X Equivalent to C, but may be made more efficient in the future. Doesn't handle set magic. The perl equivalent is C<$sv = !!$expr;>. Introduced in perl 5.35.11. =over 3 void sv_set_bool(SV *sv, const bool bool_val) =back =back =for hackers Found in file sv.c =over 4 =item C X Equivalent to C, but may be made more efficient in the future. Doesn't handle set magic. The perl equivalent is C<$sv = !1;>. Introduced in perl 5.35.11. =over 3 void sv_set_false(SV *sv) =back =back =for hackers Found in file sv.c =over 4 =item C =item C XX These copy an integer into the given SV, upgrading first if necessary. They differ only in that C handles 'set' magic; C does not. =over 3 void sv_setiv (SV * const sv, const IV num) void sv_setiv_mg(SV * const sv, const IV i) =back =back =for hackers Found in file sv.c =over 4 =item C X Invokes C> on an SV if it has 'set' magic. This is necessary after modifying a scalar, in case it is a magical variable like C<$|> or a tied variable (it calls C). This macro evaluates its argument more than once. =over 3 void SvSETMAGIC(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C =item C =item C XXXX if C is the same as C, these do nothing. Otherwise they all call some form of C>. They may evaluate their arguments more than once. The only differences are: C and C perform any required 'set' magic afterwards on the destination SV; C and C do not. C C call a non-destructive version of C. =over 3 void SvSetMagicSV(SV* dsv, SV* ssv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C XX These copy a double into the given SV, upgrading first if necessary. They differ only in that C handles 'set' magic; C does not. =over 3 void sv_setnv(SV * const sv, const NV num) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C =item C =item C =item C =item C XXXXXXX These copy a string into the SV C, making sure it is C>. In the C forms, the string must be a C literal string, enclosed in double quotes. In the C forms, the first byte of the string is pointed to by C, and C indicates the number of bytes to be copied, potentially including embedded C characters. In the plain C forms, C points to a NUL-terminated C string. That is, it points to the first byte of the string, and the copy proceeds up through the first encountered C byte. In the forms that take a C argument, if it is NULL, the SV will become undefined. The UTF-8 flag is not changed by these functions. A terminating NUL byte is guaranteed in the result. The C<_mg> forms handle 'set' magic; the other forms skip all magic. C is a cut-down alternative to C, intended ONLY to be used with a fresh sv that has been upgraded to a SVt_PV, SVt_PVIV, SVt_PVNV, or SVt_PVMG. =over 3 void sv_setpv (SV * const sv, const char * const ptr) void sv_setpv_mg (SV * const sv, const char * const ptr) void sv_setpvn (SV * const sv, const char * const ptr, const STRLEN len) void sv_setpvn_fresh(SV * const sv, const char * const ptr, const STRLEN len) void sv_setpvn_mg (SV * const sv, const char * const ptr, const STRLEN len) void sv_setpvs (SV* sv, "literal string") void sv_setpvs_mg (SV* sv, "literal string") =back =back =for hackers Found in file sv.c =over 4 =item C X Sets the SV to be a string of cur bytes length, with at least len bytes available. Ensures that there is a null byte at SvEND. Returns a char * pointer to the SvPV buffer. =over 3 char * sv_setpv_bufsize(SV * const sv, const STRLEN cur, const STRLEN len) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C =item C XXXX These work like C> but copy the text into the SV instead of appending it. The differences between these are: C and C perform 'set' magic; C and C skip all magic. C and C do not take a thread context (C) parameter, so are used in situations where the caller doesn't already have the thread context. NOTE: C must be explicitly called as C with an C parameter. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_sv_setpvf (pTHX_ SV * const sv, const char * const pat, ...) void Perl_sv_setpvf_mg (pTHX_ SV * const sv, const char * const pat, ...) void sv_setpvf_mg_nocontext(SV * const sv, const char * const pat, ...) void sv_setpvf_nocontext (SV * const sv, const char * const pat, ...) =back =back =for hackers Found in file sv.c =over 4 =item C X Copies an integer into a new SV, optionally blessing the SV. The C argument will be upgraded to an RV. That RV will be modified to point to the new SV. The C argument indicates the package for the blessing. Set C to C to avoid the blessing. The new SV will have a reference count of 1, and the RV will be returned. =over 3 SV * sv_setref_iv(SV * const rv, const char * const classname, const IV iv) =back =back =for hackers Found in file sv.c =over 4 =item C X Copies a double into a new SV, optionally blessing the SV. The C argument will be upgraded to an RV. That RV will be modified to point to the new SV. The C argument indicates the package for the blessing. Set C to C to avoid the blessing. The new SV will have a reference count of 1, and the RV will be returned. =over 3 SV * sv_setref_nv(SV * const rv, const char * const classname, const NV nv) =back =back =for hackers Found in file sv.c =over 4 =item C X Copies a pointer into a new SV, optionally blessing the SV. The C argument will be upgraded to an RV. That RV will be modified to point to the new SV. If the C argument is C, then C will be placed into the SV. The C argument indicates the package for the blessing. Set C to C to avoid the blessing. The new SV will have a reference count of 1, and the RV will be returned. Do not use with other Perl types such as HV, AV, SV, CV, because those objects will become corrupted by the pointer copy process. Note that C copies the string while this copies the pointer. =over 3 SV * sv_setref_pv(SV * const rv, const char * const classname, void * const pv) =back =back =for hackers Found in file sv.c =over 4 =item C X Copies a string into a new SV, optionally blessing the SV. The length of the string must be specified with C. The C argument will be upgraded to an RV. That RV will be modified to point to the new SV. The C argument indicates the package for the blessing. Set C to C to avoid the blessing. The new SV will have a reference count of 1, and the RV will be returned. Note that C copies the pointer while this copies the string. =over 3 SV * sv_setref_pvn(SV * const rv, const char * const classname, const char * const pv, const STRLEN n) =back =back =for hackers Found in file sv.c =over 4 =item C X Like C, but takes a literal string instead of a string/length pair. =over 3 SV * sv_setref_pvs(SV *const rv, const char *const classname, "literal string") =back =back =for hackers Found in file handy.h =over 4 =item C X Copies an unsigned integer into a new SV, optionally blessing the SV. The C argument will be upgraded to an RV. That RV will be modified to point to the new SV. The C argument indicates the package for the blessing. Set C to C to avoid the blessing. The new SV will have a reference count of 1, and the RV will be returned. =over 3 SV * sv_setref_uv(SV * const rv, const char * const classname, const UV uv) =back =back =for hackers Found in file sv.c =over 4 =item C =item C XX As C but increments the reference count of I. C will invoke 'set' magic on the SV; C will not. =over 3 void sv_setrv_inc(SV * const sv, SV * const ref) =back =back =for hackers Found in file sv.c =over 4 =item C =item C XX Copies an SV pointer into the given SV as an SV reference, upgrading it if necessary. After this, C is equal to I. This does not adjust the reference count of I. The reference I must not be NULL. C will invoke 'set' magic on the SV; C will not. =over 3 void sv_setrv_noinc(SV * const sv, SV * const ref) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C =item C XXXX These copy the contents of the source SV C into the destination SV C. C may be destroyed if it is mortal, so don't use these functions if the source SV needs to be reused. Loosely speaking, they perform a copy-by-value, obliterating any previous content of the destination. They differ only in that: C calls 'get' magic on C, but skips 'set' magic on C. C calls both 'get' magic on C and 'set' magic on C. C skips all magic. C has a C parameter which you can use to specify any combination of magic handling, and also you can specify C so that the buffers of temps will not be stolen. You probably want to instead use one of the assortment of wrappers, such as C>, C>, C> and C>. C is the primary function for copying scalars, and most other copy-ish functions and macros use it underneath. =over 3 void sv_setsv (SV *dsv, SV *ssv) void sv_setsv_flags(SV *dsv, SV *ssv, const I32 flags) void sv_setsv_mg (SV * const dsv, SV * const ssv) void sv_setsv_nomg (SV *dsv, SV *ssv) =back =back =for hackers Found in file sv.c =over 4 =item C X Equivalent to C, but may be made more efficient in the future. Doesn't handle set magic. The perl equivalent is C<$sv = !0;>. Introduced in perl 5.35.11. =over 3 void sv_set_true(SV *sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Equivalent to C, but more efficient. Doesn't handle set magic. The perl equivalent is C<$sv = undef;>. Note that it doesn't free any string buffer, unlike C. Introduced in perl 5.25.12. =over 3 void sv_set_undef(SV *sv) =back =back =for hackers Found in file sv.c =over 4 =item C =item C XX These copy an unsigned integer into the given SV, upgrading first if necessary. They differ only in that C handles 'set' magic; C does not. =over 3 void sv_setuv (SV * const sv, const UV num) void sv_setuv_mg(SV * const sv, const UV u) =back =back =for hackers Found in file sv.c =over 4 =item C X Arranges for C to be shared between threads if a suitable module has been loaded. =over 3 void SvSHARE(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns the hash for C created by C>. =over 3 struct hek* SvSHARED_HASH(SV * sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns the stash of the SV. =over 3 HV* SvSTASH(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Set the value of the STASH pointer in C to val. See C>. =over 3 void SvSTASH_set(SV* sv, HV* val) =back =back =for hackers Found in file sv.h =over 4 =item C X A convenient shortcut for calling C with the C flag. This function basically behaves like the Perl code C<$sv1 eq $sv2>. =over 3 bool sv_streq(SV *sv1, SV *sv2) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns a boolean indicating whether the strings in the two SVs are identical. If the flags argument has the C bit set, it handles get-magic too. Will coerce its args to strings if necessary. Treats C as undef. Correctly handles the UTF8 flag. If flags does not have the C bit set, an attempt to use C overloading will be made. If such overloading does not exist or the flag is set, then regular string comparison will be used instead. =over 3 bool sv_streq_flags(SV *sv1, SV *sv2, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C =item C =item C XXXXX These return a boolean indicating whether Perl would evaluate the SV as true or false. See C> for a defined/undefined test. As of Perl 5.32, all are guaranteed to evaluate C only once. Prior to that release, only C guaranteed single evaluation; now C is identical to C. C and C do not perform 'get' magic; the others do unless the scalar is already C, C, or C (the public, not the private flags). C is like C>, but C is assumed to be non-null (NN). If there is a possibility that it is NULL, use plain C. C is like C>, but C is assumed to be non-null (NN). If there is a possibility that it is NULL, use plain C. =over 3 bool SvTRUE(SV *sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns the type of the SV. See C>. =over 3 svtype SvTYPE(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Releases a mutual exclusion lock on C if a suitable module has been loaded. =over 3 void SvUNLOCK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Removes all magic of type C from an SV. =over 3 int sv_unmagic(SV * const sv, const int type) =back =back =for hackers Found in file sv.c =over 4 =item C X Removes all magic of type C with the specified C from an SV. =over 3 int sv_unmagicext(SV * const sv, const int type, const MGVTBL *vtbl) =back =back =for hackers Found in file sv.c =over 4 =item C 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>. =over 3 void sv_unref(SV *sv) =back =back =for hackers Found in file mathoms.c =over 4 =item C 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. The C argument can contain C to force the reference count to be decremented (otherwise the decrementing is conditional on the reference count being different from one or the reference being a readonly SV). See C>. =over 3 void sv_unref_flags(SV * const ref, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns a boolean indicating whether the SV contains an integer that must be interpreted as unsigned. A non-negative integer whose value is within the range of both an IV and a UV may be flagged as either C or C. =over 3 bool SvUOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Used to upgrade an SV to a more complex form. Uses C to perform the upgrade if necessary. See C>. =over 3 void SvUPGRADE(SV* sv, svtype type) =back =back =for hackers Found in file sv.h =over 4 =item C X Upgrade an SV to a more complex form. Generally adds a new body type to the SV, then copies across as much information as possible from the old body. It croaks if the SV is already in a more complex form than requested. You generally want to use the C macro wrapper, which checks the type before calling C, and hence does not croak. See also C>. =over 3 void sv_upgrade(SV * const sv, svtype new_type) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C XXX These tell an SV to use C for its string value. Normally SVs have their string stored inside the SV, but these tell the SV to use an external string instead. C should point to memory that was allocated by L>. It must be the start of a C-ed block of memory, and not a pointer to the middle of it (beware of L|perlguts/Offsets> and copy-on-write), and not be from a non-C memory allocator like C. The string length, C, must be supplied. By default this function will L> (i.e. realloc, move) the memory pointed to by C, so that the pointer should not be freed or used by the programmer after giving it to C, and neither should any pointers from "behind" that pointer (I, S + 1>) be used. In the C form, if S> is true, C is called before returning. And if S> is true, then C must be C, and the realloc will be skipped (I, the buffer is actually at least 1 byte longer than C, and already meets the requirements for storing in C). C is merely C with C set to 0, so 'set' magic is skipped. C is merely C with C set to C, so 'set' magic is performed. =over 3 void sv_usepvn (SV *sv, char *ptr, STRLEN len) void sv_usepvn_flags(SV * const sv, char *ptr, const STRLEN len, const U32 flags) void sv_usepvn_mg (SV *sv, char *ptr, STRLEN len) =back =back =for hackers Found in file sv.c =over 4 =item C X If the PV of the SV is an octet sequence in Perl's extended UTF-8 and contains a multiple-byte character, the C flag is turned on so that it looks like a character. If the PV contains only single-byte characters, the C flag stays off. Scans PV for validity and returns FALSE if the PV is invalid UTF-8. =over 3 bool sv_utf8_decode(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C =item C =item C XXX These attempt to convert the PV of an SV from characters to bytes. If the PV contains a character that cannot fit in a byte, this conversion will fail; in this case, C is returned if C is true; otherwise they croak. They are not a general purpose Unicode to byte encoding interface: use the C extension for that. They differ only in that: C processes 'get' magic on C. C does not. C has an additional C parameter in which you can specify C to process 'get' magic, or leave it cleared to not process 'get' magic. =over 3 bool sv_utf8_downgrade (SV * const sv, const bool fail_ok) bool sv_utf8_downgrade_flags(SV * const sv, const bool fail_ok, const U32 flags) bool sv_utf8_downgrade_nomg (SV * const sv, const bool fail_ok) =back =back =for hackers Found in file sv.c =over 4 =item C X Converts the PV of an SV to UTF-8, but then turns the C flag off so that it looks like octets again. =over 3 void sv_utf8_encode(SV * const sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Unsets the UTF-8 status of an SV (the data is not changed, just the flag). Do not use frivolously. =over 3 void SvUTF8_off(SV *sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Turn on the UTF-8 status of an SV (the data is not changed, just the flag). Do not use frivolously. =over 3 void SvUTF8_on(SV *sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C =item C =item C XXXX These convert the PV of an SV to its UTF-8-encoded form. The SV is forced to string form if it is not already. They always set the C flag to avoid future validity checks even if the whole string is the same in UTF-8 as not. They return the number of bytes in the converted string The forms differ in just two ways. The main difference is whether or not they perform 'get magic' on C. C skips 'get magic'; C performs it; and C and C either perform it (if the C bit is set in C) or don't (if that bit is cleared). The other difference is that C has an additional parameter, C, which allows the caller to specify an amount of space to be reserved as spare beyond what is needed for the actual conversion. This is used when the caller knows it will soon be needing yet more space, and it is more efficient to request space from the system in a single call. This form is otherwise identical to C. These are not a general purpose byte encoding to Unicode interface: use the Encode extension for that. The C flag is now ignored. =over 3 STRLEN sv_utf8_upgrade (SV *sv) STRLEN sv_utf8_upgrade_flags (SV * const sv, const I32 flags) STRLEN sv_utf8_upgrade_flags_grow(SV * const sv, const I32 flags, STRLEN extra) STRLEN sv_utf8_upgrade_nomg (SV *sv) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns a U32 value indicating the UTF-8 status of an SV. If things are set-up properly, this indicates whether or not the SV contains UTF-8 encoded data. You should use this I a call to C> or one of its variants, in case any call to string overloading updates the internal flag. If you want to take into account the L pragma, use C> instead. =over 3 U32 SvUTF8(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C =item C XXX These each coerce the given SV to UV and return it. The returned value in many circumstances will get stored in C's UV slot, but not in all cases. (Use C> to make sure it does). As of 5.37.1, all are guaranteed to evaluate C only once. C is now identical to C, but prior to 5.37.1, it was the only form guaranteed to evaluate C only once. =over 3 UV SvUV(SV *sv) =back =back =for hackers Found in file sv_inline.h =over 4 =item C X Return the unsigned integer value of an SV, doing any necessary string conversion. If C has the C bit set, does an C first. Normally used via the C and C macros. =over 3 UV sv_2uv_flags(SV * const sv, const I32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Set the value of the UV pointer in C to val. See C>. =over 3 void SvUV_set(SV* sv, UV val) =back =back =for hackers Found in file sv.h =over 4 =item C X Returns the raw value in the SV's UV slot, without checks or conversions. Only use when you are sure C is true. See also C>. =over 3 UV SvUVX(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. This is an unnecessary synonym for L =over 3 UV SvUVXx(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C XX These process their arguments like C called with a non-null C-style variable argument list, and append the formatted output to C. They differ only in that C performs 'set' magic; C skips 'set' magic. Both perform 'get' magic. They are usually accessed via their frontends C> and C>. =over 3 void sv_vcatpvf(SV * const sv, const char * const pat, va_list * const args) =back =back =for hackers Found in file sv.c =over 4 =item C =item C XX These process their arguments like C> and append the formatted output to an SV. They use an array of SVs if the C-style variable argument list is missing (C). Argument reordering (using format specifiers like C<%2$d> or C<%*2$d>) is supported only when using an array of SVs; using a C-style C argument list with a format string that uses argument reordering will yield an exception. When running with taint checks enabled, they indicate via C if results are untrustworthy (often due to the use of locales). They assume that C has the same utf8-ness as C. It's the caller's responsibility to ensure that this is so. They differ in that C has a C parameter in which you can set or clear the C and/or S flags, to specify which magic to handle or not handle; whereas plain C always specifies both 'get' and 'set' magic. They are usually used via one of the frontends L> and L>. =over 3 void sv_vcatpvfn (SV * const sv, const char * const pat, const STRLEN patlen, va_list * const args, SV ** const svargs, const Size_t sv_count, bool * const maybe_tainted) void sv_vcatpvfn_flags(SV * const sv, const char * const pat, const STRLEN patlen, va_list * const args, SV ** const svargs, const Size_t sv_count, bool * const maybe_tainted, const U32 flags) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns a boolean indicating whether the SV contains a v-string. =over 3 bool SvVOK(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C =item C XX These work like C> but copy the text into the SV instead of appending it. They differ only in that C performs 'set' magic; C skips all magic. They are usually used via their frontends, C> and C>. =over 3 void sv_vsetpvf(SV * const sv, const char * const pat, va_list * const args) =back =back =for hackers Found in file sv.c =over 4 =item C X Works like C but copies the text into the SV instead of appending it. Usually used via one of its frontends L> and L>. =over 3 void sv_vsetpvfn(SV * const sv, const char * const pat, const STRLEN patlen, va_list * const args, SV ** const svargs, const Size_t sv_count, bool * const maybe_tainted) =back =back =for hackers Found in file sv.c =over 4 =item C X Returns the vstring magic, or NULL if none =over 3 MAGIC* SvVSTRING_mg(SV * sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Like C> but the arguments are an encapsulated argument list. =over 3 SV * vnewSVpvf(const char * const pat, va_list * const args) =back =back =for hackers Found in file sv.c =head1 Tainting =over 4 =item C X Taints an SV if tainting is enabled, and if some input to the current expression is tainted--usually a variable, but possibly also implicit inputs such as locale settings. C propagates that taintedness to the outputs of an expression in a pessimistic fashion; i.e., without paying attention to precisely which outputs are influenced by which inputs. =over 3 void SvTAINT(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Checks to see if an SV is tainted. Returns TRUE if it is, FALSE if not. =over 3 bool SvTAINTED(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Untaints an SV. Be I careful with this routine, as it short-circuits some of Perl's fundamental security features. XS module authors should not use this function unless they fully understand all the implications of unconditionally untainting the value. Untainting should be done in the standard perl fashion, via a carefully crafted regexp, rather than directly untainting variables. =over 3 void SvTAINTED_off(SV* sv) =back =back =for hackers Found in file sv.h =over 4 =item C X Marks an SV as tainted if tainting is enabled. =over 3 void SvTAINTED_on(SV* sv) =back =back =for hackers Found in file sv.h =head1 Time =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the maximum value for the C offset that the system function gmtime () accepts, and defaults to 0 =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the minimum value for the C offset that the system function gmtime () accepts, and defaults to 0 =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to asctime re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C () routine is available to do the 64bit variant of asctime () =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to ctime re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C () routine is available to do the 64bit variant of ctime () =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C () routine is available to do the 64bit variant of difftime () =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to change file descriptor time stamps with C. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to return interval timers. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C system call is available for a sub-second accuracy clock. Usually, the file F needs to be included (see C>). The type "Timeval" should be used to refer to "C". =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to gmtime re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C () routine is available to do the 64bit variant of gmtime () =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to localtime re-entrantly. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C () routine is available to do the 64bit variant of localtime () =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C () routine is available to do the 64bit variant of mktime () =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C system call is available to sleep with 1E-9 sec accuracy. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to set interval timers. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to do time formatting. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine exists. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to do the opposite of gmtime () =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine exists. Note that this became obsolete on some systems (C), which now use C. It may be necessary to include F. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that the C has a C field. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that the C has a C field. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C array is available to access timezone names. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the C routine is available to let the process sleep on a sub-second accuracy. =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates that the system provides a prototype for the C function. Otherwise, it is up to the program to supply one. A good guess is extern int usleep(useconds_t); =back =for hackers Found in file config.h =over 4 =item C X This symbol is always defined, and indicates to the C program that it should include F. =over 3 #ifdef I_TIME #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol, if defined, indicates to the C program that it should include F. =over 3 #ifdef I_UTIME #include #endif =back =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the maximum value for the C offset that the system function localtime () accepts, and defaults to 0 =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the minimum value for the C offset that the system function localtime () accepts, and defaults to 0 =back =for hackers Found in file config.h =over 4 =item C X Many libc's C implementations do not call tzset, making them differ from C, and making timezone changes using $C{TZ} without explicitly calling tzset impossible. This symbol makes us call tzset before C =back =for hackers Found in file config.h =over 4 =item C X This symbol encodes the prototype of C. It is zero if C is undef, and one of the C macros of F if C is defined. =back =for hackers Found in file config.h =over 4 =item C X If C needs tzset, it is defined in this define =back =for hackers Found in file config.h =over 4 =item C X normalise S> values without the localtime() semantics (and overhead) of mktime(). =over 3 void mini_mktime(struct tm *ptm) =back =back =for hackers Found in file util.c =over 4 =item C X strftime(), but with a different API so that the return value is a pointer to the formatted result (which MUST be arranged to be FREED BY THE CALLER). This allows this function to increase the buffer size as needed, so that the caller doesn't have to worry about that. On failure it returns NULL. Note that yday and wday effectively are ignored by this function, as mini_mktime() overwrites them. Also note that it is always executed in the underlying C locale of the program, giving results based on that locale. =over 3 char * my_strftime(const char *fmt, int sec, int min, int hour, int mday, int mon, int year, int wday, int yday, int isdst) =back =back =for hackers Found in file locale.c =over 4 =item C X This function copies the locale state of the calling thread into the program's global locale, and converts the thread to use that global locale. It is intended so that Perl can safely be used with C libraries that access the global locale and which can't be converted to not access it. Effectively, this means libraries that call C> on non-Windows systems. (For portability, it is a good idea to use it on Windows as well.) A downside of using it is that it disables the services that Perl provides to hide locale gotchas from your code. The service you most likely will miss regards the radix character (decimal point) in floating point numbers. Code executed after this function is called can no longer just assume that this character is correct for the current circumstances. To return to Perl control, and restart the gotcha prevention services, call C>. Behavior is undefined for any pure Perl code that executes while the switch is in effect. The global locale and the per-thread locales are independent. As long as just one thread converts to the global locale, everything works smoothly. But if more than one does, they can easily interfere with each other, and races are likely. On Windows systems prior to Visual Studio 15 (at which point Microsoft fixed a bug), races can occur (even if only one thread has been converted to the global locale), but only if you use the following operations: =over =item L =item L, items C and C =item L, items C and C =back The first item is not fixable (except by upgrading to a later Visual Studio release), but it would be possible to work around the latter two items by having Perl change its algorithm for calculating these to use Windows API functions (likely C and C); patches welcome. XS code should never call plain C, but should instead be converted to either call L|perlapi/Perl_setlocale> (which is a drop-in for the system C) or use the methods given in L to call L|POSIX/setlocale>. Either one will transparently properly handle all cases of single- vs multi-thread, POSIX 2008-supported or not. =over 3 void switch_to_global_locale() =back =back =for hackers Found in file locale.c =over 4 =item C X This function copies the state of the program global locale into the calling thread, and converts that thread to using per-thread locales, if it wasn't already, and the platform supports them. The LC_NUMERIC locale is toggled into the standard state (using the C locale's conventions), if not within the lexical scope of S>. Perl will now consider itself to have control of the locale. Since unthreaded perls have only a global locale, this function is a no-op without threads. This function is intended for use with C libraries that do locale manipulation. It allows Perl to accommodate the use of them. Call this function before transferring back to Perl space so that it knows what state the C code has left things in. XS code should not manipulate the locale on its own. Instead, L|perlapi/Perl_setlocale> can be used at any time to query or change the locale (though changing the locale is antisocial and dangerous on multi-threaded systems that don't have multi-thread safe locale operations. (See L). Using the libc L> function should be avoided. Nevertheless, certain non-Perl libraries called from XS, do call it, and their behavior may not be able to be changed. This function, along with C>, can be used to get seamless behavior in these circumstances, as long as only one thread is involved. If the library has an option to turn off its locale manipulation, doing that is preferable to using this mechanism. C is such a library. The return value is a boolean: TRUE if the global locale at the time of call was in effect for the caller; and FALSE if a per-thread locale was in effect. =over 3 bool sync_locale() =back =back =for hackers Found in file locale.c =head1 Typedef names =over 4 =item C X This symbol contains the type of the prefix structure element in the F header file. In older versions of DB, it was int, while in newer ones it is C. =back =for hackers Found in file config.h =over 4 =item C X This symbol contains the type of the prefix structure element in the F header file. In older versions of DB, it was int, while in newer ones it is C. =back =for hackers Found in file config.h =over 4 =item C X This symbol is set to 'C' or 'C' depending on whether dirent is available or not. You should use this pseudo type to portably declare your directory entries. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used to declare file positions in libc. It can be C, long, uint, etc... It may be necessary to include F to get any typedef'ed information. =back =for hackers Found in file config.h =over 4 =item C X This variable contains the return type of C. It is usually void, but occasionally int. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the return type of C and the type of argument to C and related functions. Typically, it is the type of group ids in the kernel. It can be int, ushort, C, etc... It may be necessary to include F to get any typedef'ed information. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a C. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the signedness of a C. 1 for unsigned, -1 for signed. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the size of a C in bytes. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used for the second argument to C and C. Usually, this is the same as gidtype (C) , but sometimes it isn't. It can be int, ushort, C, etc... It may be necessary to include F to get any typedef'ed information. This is only required if you have C or C.. =back =for hackers Found in file config.h =over 4 =item C X This symbol is the type of pointer returned by malloc and realloc. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the return type of the C system call (and simultaneously the type of the first argument). Usually set to 'void *' or 'C'. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used to declare file modes for systems calls. It is usually C, but may be int or unsigned short. It may be necessary to include F to get any typedef'ed information. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used for the 2nd argument to C. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used for the 1st argument to C. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used for the argument to C. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used for the 1st argument to C. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used to declare offsets in the kernel. It can be int, long, C, etc... It may be necessary to include F to get any typedef'ed information. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the number of bytes used by the C. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used to declare process ids in the kernel. It can be int, uint, C, etc... It may be necessary to include F to get any typedef'ed information. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the type of the argument of the random seed function. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used for the 2nd, 3rd, and 4th arguments to select. Usually, this is 'C *', if C is defined, and 'int *' otherwise. This is only useful if you have C, of course. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the return type of the C system call. Usually set to 'void *' or 'char *'. =back =for hackers Found in file config.h =over 4 =item C X This symbol's value is either "void" or "int", corresponding to the appropriate return type of a signal handler. Thus, you can declare a signal handler using "C (*handler)()", and define the handler using "C C". =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used to declare length parameters for string functions. It is usually C, but may be unsigned long, int, etc. It may be necessary to include F to get any typedef'ed information. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the size of a C in bytes. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used for the size argument of various socket calls (just the base type, not the pointer-to). =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used by functions that return a count of bytes or an error condition. It must be a signed type. It is usually C, but may be long or int, etc. It may be necessary to include F or F to get any typedef'ed information. We will pick a type such that C == C. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type returned by C. It can be long, or C on C sites (in which case F should be included). =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the type used to declare user ids in the kernel. It can be int, ushort, C, etc... It may be necessary to include F to get any typedef'ed information. =back =for hackers Found in file config.h =over 4 =item C X This symbol defines the format string used for printing a C. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the signedness of a C. 1 for unsigned, -1 for signed. =back =for hackers Found in file config.h =over 4 =item C X This symbol holds the size of a C in bytes. =back =for hackers Found in file config.h =head1 Unicode Support XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX L has an introduction to this API. See also C>, C>, and C>. Various functions outside this section also work specially with Unicode. Search for the string "utf8" in this document. =over 4 =item C X This is a macro that evaluates to a string constant of the UTF-8 bytes that define the Unicode BYTE ORDER MARK (U+FEFF) for the platform that perl is compiled on. This allows code to use a mnemonic for this character that works on both ASCII and EBCDIC platforms. S> can be used to get its length in bytes. =back =for hackers Found in file unicode_constants.h =over 4 =item C X Compares the sequence of characters (stored as octets) in C, C with the sequence of characters (stored as UTF-8) in C, C. Returns 0 if they are equal, -1 or -2 if the first string is less than the second string, +1 or +2 if the first string is greater than the second string. -1 or +1 is returned if the shorter string was identical to the start of the longer string. -2 or +2 is returned if there was a difference between characters within the strings. =over 3 int bytes_cmp_utf8(const U8 *b, STRLEN blen, const U8 *u, STRLEN ulen) =back =back =for hackers Found in file utf8.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Converts a potentially UTF-8 encoded string C of length C<*lenp> into native byte encoding. On input, the boolean C<*is_utf8p> gives whether or not C is actually encoded in UTF-8. Unlike L but like L, this is non-destructive of the input string. Do nothing if C<*is_utf8p> is 0, or if there are code points in the string not expressible in native byte encoding. In these cases, C<*is_utf8p> and C<*lenp> are unchanged, and the return value is the original C. Otherwise, C<*is_utf8p> is set to 0, and the return value is a pointer to a newly created string containing a downgraded copy of C, and whose length is returned in C<*lenp>, updated. The new string is C-terminated. The caller is responsible for arranging for the memory used by this string to get freed. Upon successful return, the number of variants in the string can be computed by having saved the value of C<*lenp> before the call, and subtracting the after-call value of C<*lenp> from it. =over 3 U8 * bytes_from_utf8(const U8 *s, STRLEN *lenp, bool *is_utf8p) =back =back =for hackers Found in file utf8.c =over 4 =item C X NOTE: C is B and may change or be removed without notice. Converts a string C of length C<*lenp> bytes from the native encoding into UTF-8. Returns a pointer to the newly-created string, and sets C<*lenp> to reflect the new length in bytes. The caller is responsible for arranging for the memory used by this string to get freed. Upon successful return, the number of variants in the string can be computed by having saved the value of C<*lenp> before the call, and subtracting it from the after-call value of C<*lenp>. A C character will be written after the end of the string. If you want to convert to UTF-8 from encodings other than the native (Latin1 or EBCDIC), see L(). =over 3 U8 * bytes_to_utf8(const U8 *s, STRLEN *lenp) =back =back =for hackers Found in file utf8.c =over 4 =item C X Returns a bool giving whether or not the PV in C is to be treated as being encoded in UTF-8. You should use this I a call to C or one of its variants, in case any call to string overloading updates the internal UTF-8 encoding flag. =over 3 bool DO_UTF8(SV* sv) =back =back =for hackers Found in file utf8.h =over 4 =item C X Returns true if the leading portions of the strings C and C (either or both of which may be in UTF-8) are the same case-insensitively; false otherwise. How far into the strings to compare is determined by other input parameters. If C is true, the string C is assumed to be in UTF-8-encoded Unicode; otherwise it is assumed to be in native 8-bit encoding. Correspondingly for C with respect to C. If the byte length C is non-zero, it says how far into C to check for fold equality. In other words, C+C will be used as a goal to reach. The scan will not be considered to be a match unless the goal is reached, and scanning won't continue past that goal. Correspondingly for C with respect to C. If C is non-C and the pointer it points to is not C, that pointer is considered an end pointer to the position 1 byte past the maximum point in C beyond which scanning will not continue under any circumstances. (This routine assumes that UTF-8 encoded input strings are not malformed; malformed input can cause it to read past C). This means that if both C and C are specified, and C is less than C+C, the match will never be successful because it can never get as far as its goal (and in fact is asserted against). Correspondingly for C with respect to C. At least one of C and C must have a goal (at least one of C and C must be non-zero), and if both do, both have to be reached for a successful match. Also, if the fold of a character is multiple characters, all of them must be matched (see tr21 reference below for 'folding'). Upon a successful match, if C is non-C, it will be set to point to the beginning of the I character of C beyond what was matched. Correspondingly for C and C. For case-insensitiveness, the "casefolding" of Unicode is used instead of upper/lowercasing both the characters, see L (Case Mappings). =over 3 I32 foldEQ_utf8(const char *s1, char **pe1, UV l1, bool u1, const char *s2, char **pe2, UV l2, bool u2) =back =back =for hackers Found in file utf8.c =over 4 =item C X This is a misleadingly-named synonym for L. On ASCII-ish platforms, the name isn't misleading: the ASCII-range characters are exactly the UTF-8 invariants. But EBCDIC machines have more invariants than just the ASCII characters, so C is preferred. =over 3 bool is_ascii_string(const U8 * const s, STRLEN len) =back =back =for hackers Found in file utf8.h =over 4 =item C X Evaluates to non-zero if the first few bytes of the string starting at C and looking no further than S> are well-formed UTF-8 that represents some Unicode non-surrogate code point; otherwise it evaluates to 0. If non-zero, the value gives how many bytes starting at C comprise the code point's representation. Any bytes remaining before C, but beyond the ones needed to form the first code point in C, are not examined. The largest acceptable code point is the Unicode maximum 0x10FFFF. This differs from C> only in that it accepts non-character code points. This corresponds to L. which said that non-character code points are merely discouraged rather than completely forbidden in open interchange. See L. Use C> to check for Perl's extended UTF-8; and C> for a more customized definition. Use C>, C>, and C> to check entire strings. =over 3 Size_t isC9_STRICT_UTF8_CHAR(const U8 * const s0, const U8 * const e) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns TRUE if the first C bytes of string C form a valid UTF-8-encoded string that conforms to L; otherwise it returns FALSE. If C is 0, it will be calculated using C (which means if you use this option, that C can't have embedded C characters and has to have a terminating C byte). Note that all characters being ASCII constitute 'a valid UTF-8 string'. This function returns FALSE for strings containing any code points above the Unicode max of 0x10FFFF or surrogate code points, but accepts non-character code points per L. See also C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, and C>. =over 3 bool is_c9strict_utf8_string(const U8 *s, STRLEN len) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the location of the failure (in the case of "utf8ness failure") or the location C+C (in the case of "utf8ness success") in the C pointer. See also C>. =over 3 bool is_c9strict_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the location of the failure (in the case of "utf8ness failure") or the location C+C (in the case of "utf8ness success") in the C pointer, and the number of UTF-8 encoded characters in the C pointer. See also C>. =over 3 bool is_c9strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el) =back =back =for hackers Found in file inline.h =over 4 =item C X This is a somewhat misleadingly-named synonym for L. C is preferred, as it indicates under what conditions the string is invariant. =over 3 bool is_invariant_string(const U8 * const s, STRLEN len) =back =back =for hackers Found in file utf8.h =over 4 =item C X Evaluates to non-zero if the first few bytes of the string starting at C and looking no further than S> are well-formed UTF-8 that represents some Unicode code point completely acceptable for open interchange between all applications; otherwise it evaluates to 0. If non-zero, the value gives how many bytes starting at C comprise the code point's representation. Any bytes remaining before C, but beyond the ones needed to form the first code point in C, are not examined. The largest acceptable code point is the Unicode maximum 0x10FFFF, and must not be a surrogate nor a non-character code point. Thus this excludes any code point from Perl's extended UTF-8. This is used to efficiently decide if the next few bytes in C is legal Unicode-acceptable UTF-8 for a single character. Use C> to use the L definition of allowable code points; C> to check for Perl's extended UTF-8; and C> for a more customized definition. Use C>, C>, and C> to check entire strings. =over 3 Size_t isSTRICT_UTF8_CHAR(const U8 * const s0, const U8 * const e) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns TRUE if the first C bytes of string C form a valid UTF-8-encoded string that is fully interchangeable by any application using Unicode rules; otherwise it returns FALSE. If C is 0, it will be calculated using C (which means if you use this option, that C can't have embedded C characters and has to have a terminating C byte). Note that all characters being ASCII constitute 'a valid UTF-8 string'. This function returns FALSE for strings containing any code points above the Unicode max of 0x10FFFF, surrogate code points, or non-character code points. See also C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, and C>. =over 3 bool is_strict_utf8_string(const U8 *s, STRLEN len) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the location of the failure (in the case of "utf8ness failure") or the location C+C (in the case of "utf8ness success") in the C pointer. See also C>. =over 3 bool is_strict_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the location of the failure (in the case of "utf8ness failure") or the location C+C (in the case of "utf8ness success") in the C pointer, and the number of UTF-8 encoded characters in the C pointer. See also C>. =over 3 bool is_strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el) =back =back =for hackers Found in file inline.h =over 4 =item C X Evaluates to non-zero if the first few bytes of the string starting at C and looking no further than S> are well-formed UTF-8, as extended by Perl, that represents some code point; otherwise it evaluates to 0. If non-zero, the value gives how many bytes starting at C comprise the code point's representation. Any bytes remaining before C, but beyond the ones needed to form the first code point in C, are not examined. The code point can be any that will fit in an IV on this machine, using Perl's extension to official UTF-8 to represent those higher than the Unicode maximum of 0x10FFFF. That means that this macro is used to efficiently decide if the next few bytes in C is legal UTF-8 for a single character. Use C> to restrict the acceptable code points to those defined by Unicode to be fully interchangeable across applications; C> to use the L definition of allowable code points; and C> for a more customized definition. Use C>, C>, and C> to check entire strings. Note also that a UTF-8 "invariant" character (i.e. ASCII on non-EBCDIC machines) is a valid UTF-8 character. =over 3 Size_t isUTF8_CHAR(const U8 * const s0, const U8 * const e) =back =back =for hackers Found in file inline.h =over 4 =item C X This is identical to the macro L. =over 3 STRLEN is_utf8_char_buf(const U8 *buf, const U8 *buf_end) =back =back =for hackers Found in file mathoms.c =over 4 =item C X Evaluates to non-zero if the first few bytes of the string starting at C and looking no further than S> are well-formed UTF-8, as extended by Perl, that represents some code point, subject to the restrictions given by C; otherwise it evaluates to 0. If non-zero, the value gives how many bytes starting at C comprise the code point's representation. Any bytes remaining before C, but beyond the ones needed to form the first code point in C, are not examined. If C is 0, this gives the same results as C>; if C is C, this gives the same results as C>; and if C is C, this gives the same results as C>. Otherwise C may be any combination of the C> flags understood by C>, with the same meanings. The three alternative macros are for the most commonly needed validations; they are likely to run somewhat faster than this more general one, as they can be inlined into your code. Use L, L, and L to check entire strings. =over 3 Size_t isUTF8_CHAR_flags(const U8 * const s0, const U8 * const e, const U32 flags) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns TRUE if the fixed-width buffer starting at C with length C is entirely valid UTF-8, subject to the restrictions given by C; otherwise it returns FALSE. If C is 0, any well-formed UTF-8, as extended by Perl, is accepted without restriction. If the final few bytes of the buffer do not form a complete code point, this will return TRUE anyway, provided that C> returns TRUE for them. If C in non-zero, it can be any combination of the C> flags accepted by C>, and with the same meanings. This function differs from C> only in that the latter returns FALSE if the final few bytes of the string don't form a complete code point. =over 3 bool is_utf8_fixed_width_buf_flags(const U8 * const s, STRLEN len, const U32 flags) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the location of the failure in the C pointer. If the function returns TRUE, C<*ep> will point to the beginning of any partial character at the end of the buffer; if there is no partial character C<*ep> will contain C+C. See also C>. =over 3 bool is_utf8_fixed_width_buf_loc_flags(const U8 * const s, STRLEN len, const U8 **ep, const U32 flags) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the number of complete, valid characters found in the C pointer. =over 3 bool is_utf8_fixed_width_buf_loclen_flags(const U8 * const s, STRLEN len, const U8 **ep, STRLEN *el, const U32 flags) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns TRUE if the first C bytes of the string C are the same regardless of the UTF-8 encoding of the string (or UTF-EBCDIC encoding on EBCDIC machines); otherwise it returns FALSE. That is, it returns TRUE if they are UTF-8 invariant. On ASCII-ish machines, all the ASCII characters and only the ASCII characters fit this definition. On EBCDIC machines, the ASCII-range characters are invariant, but so also are the C1 controls. If C is 0, it will be calculated using C, (which means if you use this option, that C can't have embedded C characters and has to have a terminating C byte). See also C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, and C>. =over 3 bool is_utf8_invariant_string(const U8 * const s, STRLEN len) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but upon failure, stores the location of the first UTF-8 variant character in the C pointer; if all characters are UTF-8 invariant, this function does not change the contents of C<*ep>. =over 3 bool is_utf8_invariant_string_loc(const U8 * const s, STRLEN len, const U8 **ep) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns TRUE if the first C bytes of string C form a valid Perl-extended-UTF-8 string; returns FALSE otherwise. If C is 0, it will be calculated using C (which means if you use this option, that C can't have embedded C characters and has to have a terminating C byte). Note that all characters being ASCII constitute 'a valid UTF-8 string'. This function considers Perl's extended UTF-8 to be valid. That means that code points above Unicode, surrogates, and non-character code points are considered valid by this function. Use C>, C>, or C> to restrict what code points are considered valid. See also C>, C>, C>, C>, C>, C>, C>, =over 3 bool is_utf8_string(const U8 *s, STRLEN len) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns TRUE if the first C bytes of string C form a valid UTF-8 string, subject to the restrictions imposed by C; returns FALSE otherwise. If C is 0, it will be calculated using C (which means if you use this option, that C can't have embedded C characters and has to have a terminating C byte). Note that all characters being ASCII constitute 'a valid UTF-8 string'. If C is 0, this gives the same results as C>; if C is C, this gives the same results as C>; and if C is C, this gives the same results as C>. Otherwise C may be any combination of the C> flags understood by C>, with the same meanings. See also C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, C>, and C>. =over 3 bool is_utf8_string_flags(const U8 *s, STRLEN len, const U32 flags) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the location of the failure (in the case of "utf8ness failure") or the location C+C (in the case of "utf8ness success") in the C pointer. See also C>. =over 3 bool is_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the location of the failure (in the case of "utf8ness failure") or the location C+C (in the case of "utf8ness success") in the C pointer. See also C>. =over 3 bool is_utf8_string_loc_flags(const U8 *s, STRLEN len, const U8 **ep, const U32 flags) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the location of the failure (in the case of "utf8ness failure") or the location C+C (in the case of "utf8ness success") in the C pointer, and the number of UTF-8 encoded characters in the C pointer. See also C>. =over 3 bool is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C> but stores the location of the failure (in the case of "utf8ness failure") or the location C+C (in the case of "utf8ness success") in the C pointer, and the number of UTF-8 encoded characters in the C pointer. See also C>. =over 3 bool is_utf8_string_loclen_flags(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el, const U32 flags) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns 0 if the sequence of bytes starting at C and looking no further than S> is the UTF-8 encoding, as extended by Perl, for one or more code points. Otherwise, it returns 1 if there exists at least one non-empty sequence of bytes that when appended to sequence C, starting at position C causes the entire sequence to be the well-formed UTF-8 of some code point; otherwise returns 0. In other words this returns TRUE if C points to a partial UTF-8-encoded code point. This is useful when a fixed-length buffer is being tested for being well-formed UTF-8, but the final few bytes in it don't comprise a full character; that is, it is split somewhere in the middle of the final code point's UTF-8 representation. (Presumably when the buffer is refreshed with the next chunk of data, the new first bytes will complete the partial code point.) This function is used to verify that the final bytes in the current buffer are in fact the legal beginning of some code point, so that if they aren't, the failure can be signalled without having to wait for the next read. =over 3 bool is_utf8_valid_partial_char(const U8 * const s0, const U8 * const e) =back =back =for hackers Found in file inline.h =over 4 =item C X Like C>, it returns a boolean giving whether or not the input is a valid UTF-8 encoded partial character, but it takes an extra parameter, C, which can further restrict which code points are considered valid. If C is 0, this behaves identically to C>. Otherwise C can be any combination of the C> flags accepted by C>. If there is any sequence of bytes that can complete the input partial character in such a way that a non-prohibited character is formed, the function returns TRUE; otherwise FALSE. Non character code points cannot be determined based on partial character input. But many of the other possible excluded types can be determined from just the first one or two bytes. =over 3 bool is_utf8_valid_partial_char_flags(const U8 * const s0, const U8 * const e, const U32 flags) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns the native equivalent of the input Latin-1 code point (including ASCII and control characters) given by C. Thus, C on EBCDIC platforms returns 194. These each represent the character C<"B"> on their respective platforms. On ASCII platforms no conversion is needed, so this macro expands to just its input, adding no time nor space requirements to the implementation. For conversion of code points potentially larger than will fit in a character, use L. =over 3 U8 LATIN1_TO_NATIVE(U8 ch) =back =back =for hackers Found in file utf8.h =over 4 =item C X Returns the Latin-1 (including ASCII and control characters) equivalent of the input native code point given by C. Thus, C on EBCDIC platforms returns 65. These each represent the character C<"A"> on their respective platforms. On ASCII platforms no conversion is needed, so this macro expands to just its input, adding no time nor space requirements to the implementation. For conversion of code points potentially larger than will fit in a character, use L. =over 3 U8 NATIVE_TO_LATIN1(U8 ch) =back =back =for hackers Found in file utf8.h =over 4 =item C X Returns the Unicode equivalent of the input native code point given by C. Thus, C on EBCDIC platforms returns 67. These each represent the character C<"C"> on their respective platforms. On ASCII platforms no conversion is needed, so this macro expands to just its input, adding no time nor space requirements to the implementation. =over 3 UV NATIVE_TO_UNI(UV ch) =back =back =for hackers Found in file utf8.h =over 4 =item C X Build to the scalar C a displayable version of the UTF-8 encoded string C, length C, the displayable version being at most C bytes long (if longer, the rest is truncated and C<"..."> will be appended). The C argument can have C set to display Cable characters as themselves, C to display the C<\\[nrfta\\]> as the backslashed versions (like C<"\n">) (C is preferred over C for C<"\\">). C (and its alias C) have both C and C turned on. Additionally, there is now C which allows C<\b> for a backspace, but only when C also is set. The pointer to the PV of the C is returned. See also L. =over 3 char * pv_uni_display(SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV flags) =back =back =for hackers Found in file utf8.c =over 4 =item C X This is a macro that evaluates to a string constant of the UTF-8 bytes that define the Unicode REPLACEMENT CHARACTER (U+FFFD) for the platform that perl is compiled on. This allows code to use a mnemonic for this character that works on both ASCII and EBCDIC platforms. S> can be used to get its length in bytes. =back =for hackers Found in file unicode_constants.h =over 4 =item C X C is assumed to be an C object, the PV of C is assumed to be octets in that encoding and decoding the input starts from the position which S> pointed to. C will be concatenated with the decoded UTF-8 string from C. Decoding will terminate when the string C appears in decoding output or the input ends on the PV of C. The value which C points will be modified to the last input position on C. Returns TRUE if the terminator was found, else returns FALSE. =over 3 bool sv_cat_decode(SV *dsv, SV *encoding, SV *ssv, int *offset, char *tstr, int tlen) =back =back =for hackers Found in file sv.c =over 4 =item C X C is assumed to be an C object, on entry the PV of C is assumed to be octets in that encoding, and C will be converted into Unicode (and UTF-8). If C already is UTF-8 (or if it is not C), or if C is not a reference, nothing is done to C. If C is not an C Encoding object, bad things will happen. (See L and L.) The PV of C is returned. =over 3 char * sv_recode_to_utf8(SV *sv, SV *encoding) =back =back =for hackers Found in file sv.c =over 4 =item C X Build to the scalar C a displayable version of the scalar C, the displayable version being at most C bytes long (if longer, the rest is truncated and "..." will be appended). The C argument is as in L(). The pointer to the PV of the C is returned. =over 3 char * sv_uni_display(SV *dsv, SV *ssv, STRLEN pvlim, UV flags) =back =back =for hackers Found in file utf8.c =over 4 =item C X Returns a boolean as to whether or not C is one of the Unicode non-character code points =over 3 bool UNICODE_IS_NONCHAR(const UV uv) =back =back =for hackers Found in file utf8.h =over 4 =item C X Returns a boolean as to whether or not C is the Unicode REPLACEMENT CHARACTER =over 3 bool UNICODE_IS_REPLACEMENT(const UV uv) =back =back =for hackers Found in file utf8.h =over 4 =item C X Returns a boolean as to whether or not C is above the maximum legal Unicode code point of U+10FFFF. =over 3 bool UNICODE_IS_SUPER(const UV uv) =back =back =for hackers Found in file utf8.h =over 4 =item C X Returns a boolean as to whether or not C is one of the Unicode surrogate code points =over 3 bool UNICODE_IS_SURROGATE(const UV uv) =back =back =for hackers Found in file utf8.h =over 4 =item C X Evaluates to 0xFFFD, the code point of the Unicode REPLACEMENT CHARACTER =back =for hackers Found in file utf8.h =over 4 =item C X Returns the native equivalent of the input Unicode code point given by C. Thus, C on EBCDIC platforms returns 196. These each represent the character C<"D"> on their respective platforms. On ASCII platforms no conversion is needed, so this macro expands to just its input, adding no time nor space requirements to the implementation. =over 3 UV UNI_TO_NATIVE(UV ch) =back =back =for hackers Found in file utf8.h =over 4 =item C X This is a safer version of C>, but still not as safe as C>. This version doesn't blindly assume that the input string pointed to by C is well-formed, but verifies that there isn't a NUL terminating character before the expected end of the next character in C. The length C returns stops just before any such NUL. Perl tends to add NULs, as an insurance policy, after the end of strings in SV's, so it is likely that using this macro will prevent inadvertent reading beyond the end of the input buffer, even if it is malformed UTF-8. This macro is intended to be used by XS modules where the inputs could be malformed, and it isn't feasible to restructure to use the safer C>, for example when interfacing with a C library. =over 3 STRLEN UTF8_CHK_SKIP(char* s) =back =back =for hackers Found in file utf8.h =over 4 =item C X Returns the number of UTF-8 characters between the UTF-8 pointers C and C. WARNING: use only if you *know* that the pointers point inside the same UTF-8 buffer. =over 3 IV utf8_distance(const U8 *a, const U8 *b) =back =back =for hackers Found in file inline.h =over 4 =item C X Return the UTF-8 pointer C displaced by C characters, either forward (if C is positive) or backward (if negative). C does not need to be pointing to the starting byte of a character. If it isn't, one count of C will be used up to get to the start of the next character for forward hops, and to the start of the current character for negative ones. WARNING: Prefer L to this one. Do NOT use this function unless you B C is within the UTF-8 data pointed to by C B that on entry C is aligned on the first byte of a character or just after the last byte of a character. =over 3 U8 * utf8_hop(const U8 *s, SSize_t off) =back =back =for hackers Found in file inline.h =over 4 =item C X Return the UTF-8 pointer C displaced by up to C characters, backward. C does not need to be pointing to the starting byte of a character. If it isn't, one count of C will be used up to get to that start. C must be non-positive. C must be after or equal to C. When moving backward it will not move before C. Will not exceed this limit even if the string is not valid "UTF-8". =over 3 U8 * utf8_hop_back(const U8 *s, SSize_t off, const U8 *start) =back =back =for hackers Found in file inline.h =over 4 =item C X Return the UTF-8 pointer C displaced by up to C characters, forward. C does not need to be pointing to the starting byte of a character. If it isn't, one count of C will be used up to get to the start of the next character. C must be non-negative. C must be before or equal to C. When moving forward it will not move beyond C. Will not exceed this limit even if the string is not valid "UTF-8". =over 3 U8 * utf8_hop_forward(const U8 *s, SSize_t off, const U8 *end) =back =back =for hackers Found in file inline.h =over 4 =item C X Return the UTF-8 pointer C displaced by up to C characters, either forward or backward. C does not need to be pointing to the starting byte of a character. If it isn't, one count of C will be used up to get to the start of the next character for forward hops, and to the start of the current character for negative ones. When moving backward it will not move before C. When moving forward it will not move beyond C. Will not exceed those limits even if the string is not valid "UTF-8". =over 3 U8 * utf8_hop_safe(const U8 *s, SSize_t off, const U8 *start, const U8 *end) =back =back =for hackers Found in file inline.h =over 4 =item C X Evaluates to 1 if the byte C represents the same character when encoded in UTF-8 as when not; otherwise evaluates to 0. UTF-8 invariant characters can be copied as-is when converting to/from UTF-8, saving time. In spite of the name, this macro gives the correct result if the input string from which C comes is not encoded in UTF-8. See C> for checking if a UV is invariant. =over 3 bool UTF8_IS_INVARIANT(char c) =back =back =for hackers Found in file utf8.h =over 4 =item C X Evaluates to non-zero if the first few bytes of the string starting at C and looking no further than S> are well-formed UTF-8 that represents one of the Unicode non-character code points; otherwise it evaluates to 0. If non-zero, the value gives how many bytes starting at C comprise the code point's representation. =over 3 bool UTF8_IS_NONCHAR(const U8 *s, const U8 *e) =back =back =for hackers Found in file utf8.h =over 4 =item C X Evaluates to non-zero if the first few bytes of the string starting at C and looking no further than S> are well-formed UTF-8 that represents the Unicode REPLACEMENT CHARACTER; otherwise it evaluates to 0. If non-zero, the value gives how many bytes starting at C comprise the code point's representation. =over 3 bool UTF8_IS_REPLACEMENT(const U8 *s, const U8 *e) =back =back =for hackers Found in file utf8.h =over 4 =item C X Recall that Perl recognizes an extension to UTF-8 that can encode code points larger than the ones defined by Unicode, which are 0..0x10FFFF. This macro evaluates to non-zero if the first few bytes of the string starting at C and looking no further than S> are from this UTF-8 extension; otherwise it evaluates to 0. If non-zero, the return is how many bytes starting at C comprise the code point's representation. 0 is returned if the bytes are not well-formed extended UTF-8, or if they represent a code point that cannot fit in a UV on the current platform. Hence this macro can give different results when run on a 64-bit word machine than on one with a 32-bit word size. Note that it is illegal in Perl to have code points that are larger than what can fit in an IV on the current machine; and illegal in Unicode to have any that this macro matches =over 3 bool UTF8_IS_SUPER(const U8 *s, const U8 *e) =back =back =for hackers Found in file utf8.h =over 4 =item C X Evaluates to non-zero if the first few bytes of the string starting at C and looking no further than S> are well-formed UTF-8 that represents one of the Unicode surrogate code points; otherwise it evaluates to 0. If non-zero, the value gives how many bytes starting at C comprise the code point's representation. =over 3 bool UTF8_IS_SURROGATE(const U8 *s, const U8 *e) =back =back =for hackers Found in file utf8.h =over 4 =item C X Returns the number of characters in the sequence of UTF-8-encoded bytes starting at C and ending at the byte just before C. If and point to the same place, it returns 0 with no warning raised. If C s> or if the scan would end up past C, it raises a UTF8 warning and returns the number of valid characters. =over 3 STRLEN utf8_length(const U8 *s0, const U8 *e) =back =back =for hackers Found in file utf8.c =over 4 =item C X The maximum width of a single UTF-8 encoded character, in bytes. NOTE: Strictly speaking Perl's UTF-8 should not be called UTF-8 since UTF-8 is an encoding of Unicode, and Unicode's upper limit, 0x10FFFF, can be expressed with 4 bytes. However, Perl thinks of UTF-8 as a way to encode non-negative integers in a binary format, even those above Unicode. =back =for hackers Found in file utf8.h =over 4 =item C X The maximum number of UTF-8 bytes a single Unicode character can uppercase/lowercase/titlecase/fold into. =back =for hackers Found in file utf8.h =over 4 =item C X This typedef is used by several core functions that return PV strings, to indicate the UTF-8ness of those strings. (If you write a new function, you probably should instead return the PV in an SV with the UTF-8 flag of the SV properly set, rather than use this mechanism.) The possible values this can be are: =over =item C This means the string definitely should be treated as a sequence of UTF-8-encoded characters. Most code that needs to handle this typedef should be of the form: if (utf8ness_flag == UTF8NESS_YES) { treat as utf8; // like turning on an SV UTF-8 flag } =item C This means the string definitely should be treated as a sequence of bytes, not encoded as UTF-8. =item C This means it is equally valid to treat the string as bytes, or as UTF-8 characters; use whichever way you want. This happens when the string consists entirely of characters which have the same representation whether encoded in UTF-8 or not. =item C This means it is unknown how the string should be treated. No core function will ever return this value to a non-core caller. Instead, it is used by the caller to initialize a variable to a non-legal value. A typical call will look like: utf8ness_t string_is_utf8 = UTF8NESS_UNKNOWN const char * string = foo(arg1, arg2, ..., &string_is_utf8); if (string_is_utf8 == UTF8NESS_YES) { do something for UTF-8; } =back The following relationships hold between the enum values: =over =item S= I E= UTF8NESS_IMMATERIAL>> the string may be treated in code as non-UTF8 =item S= >> the string may be treated in code as encoded in UTF-8 =back =back =for hackers Found in file utf8.h =over 4 =item C X THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES. Most code should use L() rather than call this directly. Bottom level UTF-8 decode routine. Returns the native code point value of the first character in the string C, which is assumed to be in UTF-8 (or UTF-EBCDIC) encoding, and no longer than C bytes; C<*retlen> (if C isn't NULL) will be set to the length, in bytes, of that character. The value of C determines the behavior when C does not point to a well-formed UTF-8 character. If C is 0, encountering a malformation causes zero to be returned and C<*retlen> is set so that (S + C<*retlen>>) is the next possible position in C that could begin a non-malformed character. Also, if UTF-8 warnings haven't been lexically disabled, a warning is raised. Some UTF-8 input sequences may contain multiple malformations. This function tries to find every possible one in each call, so multiple warnings can be raised for the same sequence. Various ALLOW flags can be set in C to allow (and not warn on) individual types of malformations, such as the sequence being overlong (that is, when there is a shorter sequence that can express the same code point; overlong sequences are expressly forbidden in the UTF-8 standard due to potential security issues). Another malformation example is the first byte of a character not being a legal first byte. See F for the list of such flags. Even if allowed, this function generally returns the Unicode REPLACEMENT CHARACTER when it encounters a malformation. There are flags in F to override this behavior for the overlong malformations, but don't do that except for very specialized purposes. The C flag overrides the behavior when a non-allowed (by other flags) malformation is found. If this flag is set, the routine assumes that the caller will raise a warning, and this function will silently just set C to C<-1> (cast to C) and return zero. Note that this API requires disambiguation between successful decoding a C character, and an error return (unless the C flag is set), as in both cases, 0 is returned, and, depending on the malformation, C may be set to 1. To disambiguate, upon a zero return, see if the first byte of C is 0 as well. If so, the input was a C; if not, the input had an error. Or you can use C>. Certain code points are considered problematic. These are Unicode surrogates, Unicode non-characters, and code points above the Unicode maximum of 0x10FFFF. By default these are considered regular code points, but certain situations warrant special handling for them, which can be specified using the C parameter. If C contains C, all three classes are treated as malformations and handled as such. The flags C, C, and C (meaning above the legal Unicode maximum) can be set to disallow these categories individually. C restricts the allowed inputs to the strict UTF-8 traditionally defined by Unicode. Use C to use the strictness definition given by L. The difference between traditional strictness and C9 strictness is that the latter does not forbid non-character code points. (They are still discouraged, however.) For more discussion see L. The flags C, C, C, C, and C will cause warning messages to be raised for their respective categories, but otherwise the code points are considered valid (not malformations). To get a category to both be treated as a malformation and raise a warning, specify both the WARN and DISALLOW flags. (But note that warnings are not raised if lexically disabled nor if C is also specified.) Extremely high code points were never specified in any standard, and require an extension to UTF-8 to express, which Perl does. It is likely that programs written in something other than Perl would not be able to read files that contain these; nor would Perl understand files written by something that uses a different extension. For these reasons, there is a separate set of flags that can warn and/or disallow these extremely high code points, even if other above-Unicode ones are accepted. They are the C and C flags. For more information see C>. Of course C will treat all above-Unicode code points, including these, as malformations. (Note that the Unicode standard considers anything above 0x10FFFF to be illegal, but there are standards predating it that allow up to 0x7FFF_FFFF (2**31 -1)) A somewhat misleadingly named synonym for C is retained for backward compatibility: C. Similarly, C is usable instead of the more accurately named C. The names are misleading because these flags can apply to code points that actually do fit in 31 bits. This happens on EBCDIC platforms, and sometimes when the L> is also present. The new names accurately describe the situation in all cases. All other code points corresponding to Unicode characters, including private use and those yet to be assigned, are never considered malformed and never warn. =over 3 UV utf8n_to_uvchr(const U8 *s, STRLEN curlen, STRLEN *retlen, const U32 flags) =back =back =for hackers Found in file utf8.c =over 4 =item C X THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES. Most code should use L() rather than call this directly. This function is for code that needs to know what the precise malformation(s) are when an error is found. If you also need to know the generated warning messages, use L() instead. It is like C> but it takes an extra parameter placed after all the others, C. If this parameter is 0, this function behaves identically to C>. Otherwise, C should be a pointer to a C variable, which this function sets to indicate any errors found. Upon return, if C<*errors> is 0, there were no errors found. Otherwise, C<*errors> is the bit-wise C of the bits described in the list below. Some of these bits will be set if a malformation is found, even if the input C parameter indicates that the given malformation is allowed; those exceptions are noted: =over 4 =item C The input sequence is not standard UTF-8, but a Perl extension. This bit is set only if the input C parameter contains either the C or the C flags. Code points above 0x7FFF_FFFF (2**31 - 1) were never specified in any standard, and so some extension must be used to express them. Perl uses a natural extension to UTF-8 to represent the ones up to 2**36-1, and invented a further extension to represent even higher ones, so that any code point that fits in a 64-bit word can be represented. Text using these extensions is not likely to be portable to non-Perl code. We lump both of these extensions together and refer to them as Perl extended UTF-8. There exist other extensions that people have invented, incompatible with Perl's. On EBCDIC platforms starting in Perl v5.24, the Perl extension for representing extremely high code points kicks in at 0x3FFF_FFFF (2**30 -1), which is lower than on ASCII. Prior to that, code points 2**31 and higher were simply unrepresentable, and a different, incompatible method was used to represent code points between 2**30 and 2**31 - 1. On both platforms, ASCII and EBCDIC, C is set if Perl extended UTF-8 is used. In earlier Perls, this bit was named C, which you still may use for backward compatibility. That name is misleading, as this flag may be set when the code point actually does fit in 31 bits. This happens on EBCDIC platforms, and sometimes when the L> is also present. The new name accurately describes the situation in all cases. =item C The input sequence was malformed in that the first byte was a UTF-8 continuation byte. =item C The input C parameter was 0. =item C The input sequence was malformed in that there is some other sequence that evaluates to the same code point, but that sequence is shorter than this one. Until Unicode 3.1, it was legal for programs to accept this malformation, but it was discovered that this created security issues. =item C The code point represented by the input UTF-8 sequence is for a Unicode non-character code point. This bit is set only if the input C parameter contains either the C or the C flags. =item C The input sequence was malformed in that a non-continuation type byte was found in a position where only a continuation type one should be. See also C>. =item C The input sequence was malformed in that it is for a code point that is not representable in the number of bits available in an IV on the current platform. =item C The input sequence was malformed in that C is smaller than required for a complete sequence. In other words, the input is for a partial character sequence. C and C both indicate a too short sequence. The difference is that C indicates always that there is an error, while C means that an incomplete sequence was looked at. If no other flags are present, it means that the sequence was valid as far as it went. Depending on the application, this could mean one of three things: =over =item * The C length parameter passed in was too small, and the function was prevented from examining all the necessary bytes. =item * The buffer being looked at is based on reading data, and the data received so far stopped in the middle of a character, so that the next read will read the remainder of this character. (It is up to the caller to deal with the split bytes somehow.) =item * This is a real error, and the partial sequence is all we're going to get. =back =item C The input sequence was malformed in that it is for a non-Unicode code point; that is, one above the legal Unicode maximum. This bit is set only if the input C parameter contains either the C or the C flags. =item C The input sequence was malformed in that it is for a -Unicode UTF-16 surrogate code point. This bit is set only if the input C parameter contains either the C or the C flags. =back To do your own error handling, call this function with the C flag to suppress any warnings, and then examine the C<*errors> return. =over 3 UV utf8n_to_uvchr_error(const U8 *s, STRLEN curlen, STRLEN *retlen, const U32 flags, U32 *errors) =back =back =for hackers Found in file utf8.c =over 4 =item C X THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES. Most code should use L() rather than call this directly. This function is for code that needs to know what the precise malformation(s) are when an error is found, and wants the corresponding warning and/or error messages to be returned to the caller rather than be displayed. All messages that would have been displayed if all lexical warnings are enabled will be returned. It is just like C> but it takes an extra parameter placed after all the others, C. If this parameter is 0, this function behaves identically to C>. Otherwise, C should be a pointer to an C variable, in which this function creates a new AV to contain any appropriate messages. The elements of the array are ordered so that the first message that would have been displayed is in the 0th element, and so on. Each element is a hash with three key-value pairs, as follows: =over 4 =item C The text of the message as a C. =item C The warning category (or categories) packed into a C. =item C A single flag bit associated with this message, in a C. The bit corresponds to some bit in the C<*errors> return value, such as C. =back It's important to note that specifying this parameter as non-null will cause any warnings this function would otherwise generate to be suppressed, and instead be placed in C<*msgs>. The caller can check the lexical warnings state (or not) when choosing what to do with the returned messages. If the flag C is passed, no warnings are generated, and hence no AV is created. The caller, of course, is responsible for freeing any returned AV. =over 3 UV utf8n_to_uvchr_msgs(const U8 *s, STRLEN curlen, STRLEN *retlen, const U32 flags, U32 *errors, AV **msgs) =back =back =for hackers Found in file utf8.c =over 4 =item C X returns 0 if S= e>>; otherwise returns the number of bytes in the UTF-8 encoded character whose first byte is pointed to by C. But it never returns beyond C. On DEBUGGING builds, it asserts that S= e>>. =over 3 STRLEN UTF8_SAFE_SKIP(char* s, char* e) =back =back =for hackers Found in file utf8.h =over 4 =item C X returns the number of bytes a non-malformed UTF-8 encoded character whose first (perhaps only) byte is pointed to by C. If there is a possibility of malformed input, use instead: =over =item C> if you know the maximum ending pointer in the buffer pointed to by C; or =item C> if you don't know it. =back It is better to restructure your code so the end pointer is passed down so that you know what it actually is at the point of this call, but if that isn't possible, C> can minimize the chance of accessing beyond the end of the input buffer. =over 3 STRLEN UTF8SKIP(char* s) =back =back =for hackers Found in file utf8.h =over 4 =item C X This is a synonym for C> =over 3 STRLEN UTF8_SKIP(char* s) =back =back =for hackers Found in file utf8.h =over 4 =item C X NOTE: C is B and may change or be removed without notice. Converts a string C<"s"> of length C<*lenp> from UTF-8 into native byte encoding. Unlike L, this over-writes the original string, and updates C<*lenp> to contain the new length. Returns zero on failure (leaving C<"s"> unchanged) setting C<*lenp> to -1. Upon successful return, the number of variants in the string can be computed by having saved the value of C<*lenp> before the call, and subtracting the after-call value of C<*lenp> from it. If you need a copy of the string, see L. =over 3 U8 * utf8_to_bytes(U8 *s, STRLEN *lenp) =back =back =for hackers Found in file utf8.c =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. Returns the native code point of the first character in the string C which is assumed to be in UTF-8 encoding; C will be set to the length, in bytes, of that character. Some, but not all, UTF-8 malformations are detected, and in fact, some malformed input could cause reading beyond the end of the input buffer, which is why this function is deprecated. Use L instead. If C points to one of the detected malformations, and UTF8 warnings are enabled, zero is returned and C<*retlen> is set (if C isn't C) to -1. If those warnings are off, the computed value if well-defined (or the Unicode REPLACEMENT CHARACTER, if not) is silently returned, and C<*retlen> is set (if C isn't NULL) so that (S + C<*retlen>>) is the next possible position in C that could begin a non-malformed character. See L for details on when the REPLACEMENT CHARACTER is returned. =over 3 UV utf8_to_uvchr(const U8 *s, STRLEN *retlen) =back =back =for hackers Found in file mathoms.c =over 4 =item C X Returns the native code point of the first character in the string C which is assumed to be in UTF-8 encoding; C points to 1 beyond the end of C. C<*retlen> will be set to the length, in bytes, of that character. If C does not point to a well-formed UTF-8 character and UTF8 warnings are enabled, zero is returned and C<*retlen> is set (if C isn't C) to -1. If those warnings are off, the computed value, if well-defined (or the Unicode REPLACEMENT CHARACTER if not), is silently returned, and C<*retlen> is set (if C isn't C) so that (S + C<*retlen>>) is the next possible position in C that could begin a non-malformed character. See L for details on when the REPLACEMENT CHARACTER is returned. =over 3 UV utf8_to_uvchr_buf(const U8 *s, const U8 *send, STRLEN *retlen) =back =back =for hackers Found in file utf8.c =over 4 =item C X Evaluates to 1 if the representation of code point C is the same whether or not it is encoded in UTF-8; otherwise evaluates to 0. UTF-8 invariant characters can be copied as-is when converting to/from UTF-8, saving time. C is Unicode if above 255; otherwise is platform-native. =over 3 bool UVCHR_IS_INVARIANT(UV cp) =back =back =for hackers Found in file utf8.h =over 4 =item C X returns the number of bytes required to represent the code point C when encoded as UTF-8. C is a native (ASCII or EBCDIC) code point if less than 255; a Unicode code point otherwise. =over 3 STRLEN UVCHR_SKIP(UV cp) =back =back =for hackers Found in file utf8.h =over 4 =item C X Adds the UTF-8 representation of the native code point C to the end of the string C; C should have at least C (up to C) free bytes available. The return value is the pointer to the byte after the end of the new character. In other words, d = uvchr_to_utf8_flags(d, uv, flags); or, in most cases, d = uvchr_to_utf8_flags(d, uv, 0); This is the Unicode-aware way of saying *(d++) = uv; If C is 0, this function accepts any code point from 0..C as input. C is typically 0x7FFF_FFFF in a 32-bit word. Specifying C can further restrict what is allowed and not warned on, as follows: If C is a Unicode surrogate code point and C is set, the function will raise a warning, provided UTF8 warnings are enabled. If instead C is set, the function will fail and return NULL. If both flags are set, the function will both warn and return NULL. Similarly, the C and C flags affect how the function handles a Unicode non-character. And likewise, the C and C flags affect the handling of code points that are above the Unicode maximum of 0x10FFFF. Languages other than Perl may not be able to accept files that contain these. The flag C selects all three of the above WARN flags; and C selects all three DISALLOW flags. C restricts the allowed inputs to the strict UTF-8 traditionally defined by Unicode. Similarly, C and C are shortcuts to select the above-Unicode and surrogate flags, but not the non-character ones, as defined in L. See L. Extremely high code points were never specified in any standard, and require an extension to UTF-8 to express, which Perl does. It is likely that programs written in something other than Perl would not be able to read files that contain these; nor would Perl understand files written by something that uses a different extension. For these reasons, there is a separate set of flags that can warn and/or disallow these extremely high code points, even if other above-Unicode ones are accepted. They are the C and C flags. For more information see C>. Of course C will treat all above-Unicode code points, including these, as malformations. (Note that the Unicode standard considers anything above 0x10FFFF to be illegal, but there are standards predating it that allow up to 0x7FFF_FFFF (2**31 -1)) A somewhat misleadingly named synonym for C is retained for backward compatibility: C. Similarly, C is usable instead of the more accurately named C. The names are misleading because on EBCDIC platforms,these flags can apply to code points that actually do fit in 31 bits. The new names accurately describe the situation in all cases. =over 3 U8 * uvchr_to_utf8_flags(U8 *d, UV uv, UV flags) =back =back =for hackers Found in file utf8.c =over 4 =item C X THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES. Most code should use C()> rather than call this directly. This function is for code that wants any warning and/or error messages to be returned to the caller rather than be displayed. All messages that would have been displayed if all lexical warnings are enabled will be returned. It is just like C> but it takes an extra parameter placed after all the others, C. If this parameter is 0, this function behaves identically to C>. Otherwise, C should be a pointer to an C variable, in which this function creates a new HV to contain any appropriate messages. The hash has three key-value pairs, as follows: =over 4 =item C The text of the message as a C. =item C The warning category (or categories) packed into a C. =item C A single flag bit associated with this message, in a C. The bit corresponds to some bit in the C<*errors> return value, such as C. =back It's important to note that specifying this parameter as non-null will cause any warnings this function would otherwise generate to be suppressed, and instead be placed in C<*msgs>. The caller can check the lexical warnings state (or not) when choosing what to do with the returned messages. The caller, of course, is responsible for freeing any returned HV. =over 3 U8 * uvchr_to_utf8_flags_msgs(U8 *d, UV uv, UV flags, HV **msgs) =back =back =for hackers Found in file utf8.c =over 4 =item C X Adds the UTF-8 representation of the native code point C to the end of the string C; C should have at least C (up to C) free bytes available. The return value is the pointer to the byte after the end of the new character. In other words, d = uvchr_to_utf8(d, uv); is the recommended wide native character-aware way of saying *(d++) = uv; This function accepts any code point from 0..C as input. C is typically 0x7FFF_FFFF in a 32-bit word. It is possible to forbid or warn on non-Unicode code points, or those that may be problematic by using L. =over 3 U8 * uvchr_to_utf8(U8 *d, UV uv) =back =back =for hackers Found in file utf8.c =head1 Utility Functions =over 4 =item C X Returns a pointer to one element past the final element of the input C array. =over 3 void * C_ARRAY_END(void *a) =back =back =for hackers Found in file handy.h =over 4 =item C X Returns the number of elements in the input C array (so you want your zero-based indices to be less than but not equal to). =over 3 STRLEN C_ARRAY_LENGTH(void *a) =back =back =for hackers Found in file handy.h =over 4 =item C X Fill C with current working directory =over 3 int getcwd_sv(SV *sv) =back =back =for hackers Found in file util.c =over 4 =item C X Returns 1 if this macro is being called during the compilation phase of the program; otherwise 0; =over 3 bool IN_PERL_COMPILETIME =back =back =for hackers Found in file cop.h =over 4 =item C X Returns 1 if this macro is being called during the execution phase of the program; otherwise 0; =over 3 bool IN_PERL_RUNTIME =back =back =for hackers Found in file cop.h =over 4 =item C X Same as L. =over 3 bool IS_SAFE_SYSCALL(NN const char *pv, STRLEN len, NN const char *what, NN const char *op_name) =back =back =for hackers Found in file perl.h =over 4 =item C X Test that the given C (with length C) doesn't contain any internal C characters. If it does, set C to C, optionally warn using the C category, and return FALSE. Return TRUE if the name is safe. C and C are used in any warning. Used by the C macro. =over 3 bool is_safe_syscall(const char *pv, STRLEN len, const char *what, const char *op_name) =back =back =for hackers Found in file inline.h =over 4 =item C X A wrapper for the C library L. Don't use the latter, as the perl version has desirable safeguards =over 3 void my_setenv(const char *nam, const char *val) =back =back =for hackers Found in file util.c =over 4 =item C X Constructs, checks and returns an op containing a pad offset. C is the opcode, which should be one of C, C, C or C. The returned op will have the C field set by the C argument. This is convenient when constructing a large optree in nested function calls, as it avoids needing to store the pad op directly to set the C field as a side-effect. For example o = op_append_elem(OP_LINESEQ, o, newPADxVOP(OP_PADSV, 0, padix)); =over 3 OP * newPADxVOP(I32 type, I32 flags, PADOFFSET padix) =back =back =for hackers Found in file inline.h =over 4 =item C X Returns the given phase's name as a NUL-terminated string. For example, to print a stack trace that includes the current interpreter phase you might do: const char* phase_name = phase_name(PL_phase); mess("This is weird. (Perl phase: %s)", phase_name); =over 3 const char * const phase_name(enum perl_phase) =back =back =for hackers Found in file perl.h =over 4 =item C X PoisonWith(0xEF) for catching access to freed memory. =over 3 void Poison(void* dest, int nitems, type) =back =back =for hackers Found in file handy.h =over 4 =item C X PoisonWith(0xEF) for catching access to freed memory. =over 3 void PoisonFree(void* dest, int nitems, type) =back =back =for hackers Found in file handy.h =over 4 =item C X PoisonWith(0xAB) for catching access to allocated but uninitialized memory. =over 3 void PoisonNew(void* dest, int nitems, type) =back =back =for hackers Found in file handy.h =over 4 =item C X Fill up memory with a byte pattern (a byte repeated over and over again) that hopefully catches attempts to access uninitialized memory. =over 3 void PoisonWith(void* dest, int nitems, type, U8 byte) =back =back =for hackers Found in file handy.h =over 4 =item C X This is an architecture-independent macro to copy one structure to another. =over 3 void StructCopy(type *src, type *dest, type) =back =back =for hackers Found in file handy.h =over 4 =item C 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 C function pointer and because it could potentially warn under some level of strict-ness. =over 3 bool sv_destroyable(SV *sv) =back =back =for hackers Found in file util.c =over 4 =item C 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 C function pointer and because it could potentially warn under some level of strict-ness. =over 3 void sv_nosharing(SV *sv) =back =back =for hackers Found in file util.c =head1 Versioning =over 4 =item C 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. =over 3 SV * new_version(SV *ver) =back =back =for hackers Found in file vutil.c =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. The major number component of the perl interpreter currently being compiled or executing. This has been C<5> from 1993 into 2020. Instead use one of the version comparison macros. See C>. =back =for hackers Found in file patchlevel.h =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. The micro number component of the perl interpreter currently being compiled or executing. In stable releases this gives the dot release number for maintenance updates. In development releases this gives a tag for a snapshot of the status at various points in the development cycle. Instead use one of the version comparison macros. See C>. =back =for hackers Found in file patchlevel.h =over 4 =item C X C> It is planned to remove C from a future release of Perl. Do not use it for new code; remove it from existing code. The minor number component of the perl interpreter currently being compiled or executing. Between 1993 into 2020, this has ranged from 0 to 33. Instead use one of the version comparison macros. See C>. =back =for hackers Found in file patchlevel.h =over 4 =item C =item C =item C =item C =item C =item C XXXXXX Returns whether or not the perl currently being compiled has the specified relationship to the perl given by the parameters. For example, #if PERL_VERSION_GT(5,24,2) code that will only be compiled on perls after v5.24.2 #else fallback code #endif Note that this is usable in making compile-time decisions You may use the special value '*' for the final number to mean ALL possible values for it. Thus, #if PERL_VERSION_EQ(5,31,'*') means all perls in the 5.31 series. And #if PERL_VERSION_NE(5,24,'*') means all perls EXCEPT 5.24 ones. And #if PERL_VERSION_LE(5,9,'*') is effectively #if PERL_VERSION_LT(5,10,0) This means you don't have to think so much when converting from the existing deprecated C to using this macro: #if PERL_VERSION <= 9 becomes #if PERL_VERSION_LE(5,9,'*') =over 3 bool PERL_VERSION_EQ(const U8 major, const U8 minor, const U8 patch) =back =back =for hackers Found in file handy.h =over 4 =item C 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. =over 3 const char * prescan_version(const char *s, bool strict, const char **errstr, bool *sqv, int *ssaw_decimal, int *swidth, bool *salpha) =back =back =for hackers Found in file vutil.c =over 4 =item C 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. =over 3 const char * scan_version(const char *s, SV *rv, bool qv) =back =back =for hackers Found in file vutil.c =over 4 =item C 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. =over 3 SV * upg_version(SV *ver, bool qv) =back =back =for hackers Found in file vutil.c =over 4 =item C X Version object aware cmp. Both operands must already have been converted into version objects. =over 3 int vcmp(SV *lhv, SV *rhv) =back =back =for hackers Found in file vutil.c =over 4 =item C 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. =over 3 SV * vnormal(SV *vs) =back =back =for hackers Found in file vutil.c =over 4 =item C 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. =over 3 SV * vnumify(SV *vs) =back =back =for hackers Found in file vutil.c =over 4 =item C 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. =over 3 SV * vstringify(SV *vs) =back =back =for hackers Found in file vutil.c =over 4 =item C 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): =over 4 =item * The SV is an HV or a reference to an HV =item * The hash contains a "version" key =item * The "version" key has a reference to an AV as its value =back =over 3 SV * vverify(SV *vs) =back =back =for hackers Found in file vutil.c =head1 Warning and Dieing XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX In all these calls, the C> parameters are warning category constants. You can see the ones currently available in L, just capitalize all letters in the names and prefix them by C. So, for example, the category C used in a perl program becomes C when used in XS code and passed to one of the calls below. =over 4 =item C =item C =item C =item C XXXX These return a boolean as to whether or not warnings are enabled for any of the warning category(ies) parameters: C, C, .... Should any of the categories by default be enabled even if not within the scope of S>, instead use the C> macros. The categories must be completely independent, one may not be subclassed from the other. =over 3 bool ckWARN (U32 w) bool ckWARN2(U32 w1, U32 w2) bool ckWARN3(U32 w1, U32 w2, U32 w3) bool ckWARN4(U32 w1, U32 w2, U32 w3, U32 w4) =back =back =for hackers Found in file warnings.h =over 4 =item C =item C =item C =item C XXXX Like C>, but for use if and only if the warning category(ies) is by default enabled even if not within the scope of S>. =over 3 bool ckWARN_d (U32 w) bool ckWARN2_d(U32 w1, U32 w2) bool ckWARN3_d(U32 w1, U32 w2, U32 w3) bool ckWARN4_d(U32 w1, U32 w2, U32 w3, U32 w4) =back =back =for hackers Found in file warnings.h =over 4 =item C =item C XX If none of the warning categories given by C are enabled, do nothing; otherwise call C> or C> with the passed-in parameters;. C must be one of the C>, C, C, C macros populated with the appropriate number of warning categories. The two forms differ only in that C should be used if warnings for any of the categories are by default enabled. NOTE: C must be explicitly called as C with an C parameter. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_ck_warner(pTHX_ U32 err, const char *pat, ...) =back =back =for hackers Found in file util.c =over 4 =item C X Clear the contents of C<$@>, setting it to the empty string. This replaces any read-only SV with a fresh SV and removes any magic. =over 3 void CLEAR_ERRSV() =back =back =for hackers Found in file perl.h =over 4 =item C =item C XX These are XS interfaces to Perl's C function. They take a sprintf-style format pattern and argument list, which 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 C>. The error message will be used as an exception, by default returning control to the nearest enclosing C, but subject to modification by a C<$SIG{__DIE__}> handler. In any case, these croak functions never return normally. For historical reasons, if C is null then the contents of C (C<$@>) will be used as an error message or object instead of building an error message from arguments. If you want to throw a non-string object, or build an error message in an SV yourself, it is preferable to use the C> function, which does not involve clobbering C. The two forms differ only in that C does not take a thread context (C) parameter. It is usually preferred as it takes up fewer bytes of code than plain C, and time is rarely a critical resource when you are about to throw an exception. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_croak (pTHX_ const char *pat, ...) void croak_nocontext(const char *pat, ...) =back =back =for hackers Found in file util.c =over 4 =item C X This encapsulates a common reason for dying, generating terser object code than using the generic C. It is exactly equivalent to C (which expands to something like "Modification of a read-only value attempted"). Less code used on exception code paths reduces CPU cache pressure. =over 3 void croak_no_modify() =back =back =for hackers Found in file util.c =over 4 =item C X This is an XS interface to Perl's C function. C is the error message or object. If it is a reference, it will be used as-is. Otherwise it is used as a string, and if it 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. The error message or object will be used as an exception, by default returning control to the nearest enclosing C, but subject to modification by a C<$SIG{__DIE__}> handler. In any case, the C function never returns normally. To die with a simple string message, the L function may be more convenient. =over 3 void croak_sv(SV *baseex) =back =back =for hackers Found in file util.c =over 4 =item C =item C XX These behave the same as L, except for the return type. They should be used only where the C return type is required. They never actually return. The two forms differ only in that C does not take a thread context (C) parameter, so is used in situations where the caller doesn't already have the thread context. NOTE: C must be explicitly called as C with an C parameter. =over 3 OP * Perl_die (pTHX_ const char *pat, ...) OP * die_nocontext(const char *pat, ...) =back =back =for hackers Found in file util.c =over 4 =item C X This behaves the same as L, except for the return type. It should be used only where the C return type is required. The function never actually returns. =over 3 OP * die_sv(SV *baseex) =back =back =for hackers Found in file util.c =over 4 =item C X Returns the SV for C<$@>, creating it if needed. =over 3 SV * ERRSV =back =back =for hackers Found in file perl.h =over 4 =item C =item C =item C =item C XXXX These macros are used to pack warning categories into a single U32 to pass to macros and functions that take a warning category parameter. The number of categories to pack is given by the name, with a corresponding number of category parameters passed. =over 3 U32 packWARN (U32 w1) U32 packWARN2(U32 w1, U32 w2) U32 packWARN3(U32 w1, U32 w2, U32 w3) U32 packWARN4(U32 w1, U32 w2, U32 w3, U32 w4) =back =back =for hackers Found in file warnings.h =over 4 =item C X Clean up ERRSV so we can safely set it. This replaces any read-only SV with a fresh writable copy and removes any magic. =over 3 void SANE_ERRSV() =back =back =for hackers Found in file perl.h =over 4 =item C X This is an XS interface to Perl's C function. 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. The error message will be used as an exception, by default returning control to the nearest enclosing C, but subject to modification by a C<$SIG{__DIE__}> handler. In any case, the C function never returns normally. For historical reasons, if C is null then the contents of C (C<$@>) will be used as an error message or object instead of building an error message from arguments. If you want to throw a non-string object, or build an error message in an SV yourself, it is preferable to use the L function, which does not involve clobbering C. =over 3 void vcroak(const char *pat, va_list *args) =back =back =for hackers Found in file util.c =over 4 =item C X This is an XS interface to Perl's C function. This is like C>, but C are an encapsulated argument list. Unlike with L, C is not permitted to be null. =over 3 void vwarn(const char *pat, va_list *args) =back =back =for hackers Found in file util.c =over 4 =item C X This is like C>, but C are an encapsulated argument list. =over 3 void vwarner(U32 err, const char *pat, va_list *args) =back =back =for hackers Found in file util.c =over 4 =item C =item C XX These are XS interfaces to Perl's C function. They take a sprintf-style format pattern and argument list, which 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 C>. The error message or object will by default be written to standard error, but this is subject to modification by a C<$SIG{__WARN__}> handler. Unlike with C>, C is not permitted to be null. The two forms differ only in that C does not take a thread context (C) parameter, so is used in situations where the caller doesn't already have the thread context. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_warn (pTHX_ const char *pat, ...) void warn_nocontext(const char *pat, ...) =back =back =for hackers Found in file util.c =over 4 =item C =item C XX These output a warning of the specified category (or categories) given by C, using the sprintf-style format pattern C, and argument list. C must be one of the C>, C, C, C macros populated with the appropriate number of warning categories. If any of the warning categories they specify is fatal, a fatal exception is thrown. In any event a message is generated by the pattern and arguments. 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. The error message or object will by default be written to standard error, but this is subject to modification by a C<$SIG{__WARN__}> handler. C is not permitted to be null. The two forms differ only in that C does not take a thread context (C) parameter, so is used in situations where the caller doesn't already have the thread context. These functions differ from the similarly named C> functions, in that the latter are for XS code to unconditionally display a warning, whereas these are for code that may be compiling a perl program, and does extra checking to see if the warning should be fatal. NOTE: C must be explicitly called as C with an C parameter. =over 3 void Perl_warner (pTHX_ U32 err, const char *pat, ...) void warner_nocontext(U32 err, const char *pat, ...) =back =back =for hackers Found in file util.c =over 4 =item C X This is an XS interface to Perl's C function. C is the error message or object. If it is a reference, it will be used as-is. Otherwise it is used as a string, and if it 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. The error message or object will by default be written to standard error, but this is subject to modification by a C<$SIG{__WARN__}> handler. To warn with a simple string message, the L function may be more convenient. =over 3 void warn_sv(SV *baseex) =back =back =for hackers Found in file util.c =head1 XS F compiles XS code into C. See L. =for comment Some variables below are flagged with 'u' because Devel::PPPort can't currently readily test them as they spring into existence by compiling with xsubpp. =over 4 =item C Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C<_aMY_CXT> Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C X Variable which is setup by C to indicate the stack base offset, used by the C, C and C macros. The C macro must be called prior to setup the C variable. =over 3 I32 ax =back =back =for hackers Found in file XSUB.h =over 4 =item C X Variable which is setup by C to indicate the class name for a C++ XS constructor. This is always a C. See C>. =over 3 char* CLASS =back =back =for hackers Found in file XSUB.h =over 4 =item C X Sets up the C variable. This is usually handled automatically by C by calling C. =over 3 dAX; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Sets up the C variable and stack marker variable C. This is usually handled automatically by C by calling C. =over 3 dAXMARK; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Sets up the C variable. This is usually handled automatically by C by calling C. =over 3 dITEMS; =back =back =for hackers Found in file XSUB.h =over 4 =item C Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C X Now a placeholder that declares nothing =over 3 dMY_CXT_SV; =back =back =for hackers Found in file perl.h =over 4 =item C X Sets up any variable needed by the C macro. It used to define C, but it is currently a noop. However, it is strongly advised to still use it for ensuring past and future compatibility. =over 3 dUNDERBAR; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Sets up stack and mark pointers for an XSUB, calling C and C. Sets up the C and C variables by calling C and C. This is usually handled automatically by C. =over 3 dXSARGS; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Sets up the C variable for an XSUB which has aliases. This is usually handled automatically by C. =over 3 dXSI32; =back =back =for hackers Found in file XSUB.h =over 4 =item C X Variable which is setup by C to indicate the number of items on the stack. See L. =over 3 I32 items =back =back =for hackers Found in file XSUB.h =over 4 =item C X Variable which is setup by C to indicate which of an XSUB's aliases was used to invoke it. See L. =over 3 I32 ix =back =back =for hackers Found in file XSUB.h =over 4 =item C Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C<_pMY_CXT> Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C X Variable which is setup by C to hold the return value for an XSUB. This is always the proper type for the XSUB. See L. =over 3 type RETVAL =back =back =for hackers Found in file XSUB.h =over 4 =item C X Used to access elements on the XSUB's stack. =over 3 SV* ST(int ix) =back =back =for hackers Found in file XSUB.h =over 4 =item C Described in L. =back =for hackers Found in file dist/ExtUtils-ParseXS/lib/perlxs.pod =over 4 =item C X Variable which is setup by C to designate the object in a C++ XSUB. This is always the proper type for the C++ object. See C> and L. =over 3 type THIS =back =back =for hackers Found in file XSUB.h =over 4 =item C X The SV* corresponding to the C<$_> variable. Works even if there is a lexical C<$_> in scope. =back =for hackers Found in file XSUB.h =over 4 =item C X Macro to declare an XSUB and its C parameter list. This is handled by C. It is the same as using the more explicit C macro; the latter is preferred. =back =for hackers Found in file XSUB.h =over 4 =item C X Macro to declare an XSUB and its C parameter list explicitly exporting the symbols. =back =for hackers Found in file XSUB.h =over 4 =item C X Macro to declare an XSUB and its C parameter list without exporting the symbols. This is handled by C and generally preferable over exporting the XSUB symbols unnecessarily. =for comment XS_INTERNAL marked 'u' because declaring a function static within our test function doesn't work =back =for hackers Found in file XSUB.h =over 4 =item C X Macro used by C> and C> to declare a function prototype. You probably shouldn't be using this directly yourself. =back =for hackers Found in file XSUB.h =head1 Undocumented elements The following functions have been flagged as part of the public API, but are currently undocumented. Use them at your own risk, as the interfaces are subject to change. Functions that are not listed in this document are not intended for public use, and should NOT be used under any circumstances. If you feel you need to use one of these functions, first send email to L. It may be that there is a good reason for the function not being documented, and it should be removed from this list; or it may just be that no one has gotten around to documenting it. In the latter case, you will be asked to submit a patch to document the function. Once your patch is accepted, it will indicate that the interface is stable (unless it is explicitly marked otherwise) and usable by you. XXXX XXXXX XXXXXX X clone_params_del newANONATTRSUB newAVREF newSVREF clone_params_new newANONHASH newCVREF resume_compcv do_open newANONLIST newGVREF sv_dup do_openn newANONSUB newHVREF sv_dup_inc Next are the API-flagged elements that are considered experimental. Using one of these is even more risky than plain undocumented ones. They are listed here because they should be listed somewhere (so their existence doesn't get lost) and this is the best place for them. XXX XXX XXXX apply_attrs_string hv_store_flags thread_locale_init gv_fetchmethod_pv_flags leave_adjust_stacks thread_locale_term gv_fetchmethod_pvn_flags newXS_flags gv_fetchmethod_sv_flags savetmps Finally are deprecated undocumented API elements. Do not use any for new code; remove all occurrences of all of these from existing code. There are currently no items of this type =head1 AUTHORS Until May 1997, this document was maintained by Jeff Okamoto . It is now maintained as part of Perl itself. With lots of help and suggestions from Dean Roehrich, Malcolm Beattie, Andreas Koenig, Paul Hudson, Ilya Zakharevich, Paul Marquess, Neil Bowers, Matthew Green, Tim Bunce, Spider Boardman, Ulrich Pfeifer, Stephen McCamant, and Gurusamy Sarathy. API Listing originally by Dean Roehrich . Updated to be autogenerated from comments in the source by Benjamin Stuhl. =head1 SEE ALSO F, L, L, L, L, L, L, L, L, L, L, L, L, L, L =cut ex: set ro ft=pod: