This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
one more round of is_utf8_foo tuneup
[perl5.git] / pod / perlapi.pod
index 80ee35b..86d97ff 100644 (file)
@@ -179,7 +179,7 @@ Found in file av.c
 Returns the highest index in the array.  Returns -1 if the array is
 empty.
 
-       I32     av_len(AV* ar)
+       I32     av_len(const AV* ar)
 
 =for hackers
 Found in file av.c
@@ -693,7 +693,7 @@ Found in file perl.c
 
 The engine implementing pack() Perl function.
 
-       void    packlist(SV *cat, char *pat, char *patend, SV **beglist, SV **endlist)
+       void    packlist(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist)
 
 =for hackers
 Found in file pp_pack.c
@@ -703,7 +703,7 @@ Found in file pp_pack.c
 The engine implementing pack() Perl function. Note: parameters next_in_list and
 flags are not used. This call should not be used; use packlist instead.
 
-       void    pack_cat(SV *cat, char *pat, char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
+       void    pack_cat(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
 
 =for hackers
 Found in file pp_pack.c
@@ -714,7 +714,7 @@ The engine implementing unpack() Perl function. C<unpackstring> puts the
 extracted list items on the stack and returns the number of elements.
 Issue C<PUTBACK> before and C<SPAGAIN> after the call to this function.
 
-       I32     unpackstring(char *pat, char *patend, char *s, char *strend, U32 flags)
+       I32     unpackstring(const char *pat, const char *patend, const char *s, const char *strend, U32 flags)
 
 =for hackers
 Found in file pp_pack.c
@@ -724,7 +724,7 @@ Found in file pp_pack.c
 The engine implementing unpack() Perl function. Note: parameters strbeg, new_s
 and ocnt are not used. This call should not be used, use unpackstring instead.
 
-       I32     unpack_str(char *pat, char *patend, char *s, char *strbeg, char *strend, char **new_s, I32 ocnt, U32 flags)
+       I32     unpack_str(const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags)
 
 =for hackers
 Found in file pp_pack.c
@@ -883,11 +883,24 @@ Found in file gv.c
 =item gv_stashpv
 
 Returns a pointer to the stash for a specified package.  C<name> should
-be a valid UTF-8 string.  If C<create> is set then the package will be
+be a valid UTF-8 string and must be null-terminated.  If C<create> is set
+then the package will be created if it does not already exist.  If C<create>
+is not set and the package does not exist then NULL is returned.
+
+       HV*     gv_stashpv(const char* name, I32 create)
+
+=for hackers
+Found in file gv.c
+
+=item gv_stashpvn
+
+Returns a pointer to the stash for a specified package.  C<name> should
+be a valid UTF-8 string.  The C<namelen> parameter indicates the length of
+the C<name>, in bytes.  If C<create> is set then the package will be
 created if it does not already exist.  If C<create> is not set and the
 package does not exist then NULL is returned.
 
-       HV*     gv_stashpv(const char* name, I32 create)
+       HV*     gv_stashpvn(const char* name, U32 namelen, I32 create)
 
 =for hackers
 Found in file gv.c
@@ -1096,7 +1109,7 @@ Clears any placeholders from a hash.  If a restricted hash has any of its keys
 marked as readonly and the key is subsequently deleted, the key is not actually
 deleted but is marked by assigning it a value of &PL_sv_placeholder.  This tags
 it so it will be ignored by future operations such as iterating over the hash,
-but will still allow the hash to have a value reaasigned to the key at some
+but will still allow the hash to have a value reassigned to the key at some
 future point.  This function clears any such placeholder keys from the hash.
 See Hash::Util::lock_keys() for an example of its use.
 
@@ -1398,7 +1411,7 @@ Found in file mg.c
 
 Finds the magic pointer for type matching the SV.  See C<sv_magic>.
 
-       MAGIC*  mg_find(SV* sv, int type)
+       MAGIC*  mg_find(const SV* sv, int type)
 
 =for hackers
 Found in file mg.c
@@ -1489,7 +1502,7 @@ Found in file sv.h
 
 =item SvSetMagicSV_nosteal
 
-Like C<SvSetMagicSV>, but does any set magic required afterwards.
+Like C<SvSetSV_nosteal>, but does any set magic required afterwards.
 
        void    SvSetMagicSV_nosteal(SV* dsv, SV* ssv)
 
@@ -1686,6 +1699,16 @@ which is shared between threads.
 =for hackers
 Found in file util.c
 
+=item savesvpv
+
+A version of C<savepv()>/C<savepvn()> which gets the string to duplicate from
+the passed in SV using C<SvPV()>
+
+       char*   savesvpv(SV* sv)
+
+=for hackers
+Found in file util.c
+
 =item StructCopy
 
 This is an architecture-independent macro to copy one structure to another.
@@ -1805,7 +1828,7 @@ is a alpha version).  The boolean qv denotes that the version
 should be interpreted as if it had multiple decimals, even if
 it doesn't.
 
-       char*   scan_version(char *vstr, SV *sv, bool qv)
+       char*   scan_version(const char *vstr, SV *sv, bool qv)
 
 =for hackers
 Found in file util.c
@@ -2008,7 +2031,7 @@ invalid character will also trigger a warning.
 On return I<*len> is set to the length of the scanned string,
 and I<*flags> gives output flags.
 
-If the value is <= UV_MAX it is returned as a UV, the output flags are clear,
+If the value is <= C<UV_MAX> it is returned as a UV, the output flags are clear,
 and nothing is written to I<*result>. If the value is > UV_MAX C<grok_bin>
 returns UV_MAX, sets C<PERL_SCAN_GREATER_THAN_UV_MAX> in the output flags,
 and writes the value to I<*result> (or the value is discarded if I<result>
@@ -2019,7 +2042,7 @@ C<PERL_SCAN_DISALLOW_PREFIX> is set in I<*flags> on entry. If
 C<PERL_SCAN_ALLOW_UNDERSCORES> is set in I<*flags> then the binary
 number may use '_' characters to separate digits.
 
-       UV      grok_bin(char* start, STRLEN* len, I32* flags, NV *result)
+       UV      grok_bin(const char* start, STRLEN* len_p, I32* flags, NV *result)
 
 =for hackers
 Found in file numeric.c
@@ -2047,7 +2070,7 @@ C<PERL_SCAN_DISALLOW_PREFIX> is set in I<*flags> on entry. If
 C<PERL_SCAN_ALLOW_UNDERSCORES> is set in I<*flags> then the hex
 number may use '_' characters to separate digits.
 
-       UV      grok_hex(char* start, STRLEN* len, I32* flags, NV *result)
+       UV      grok_hex(const char* start, STRLEN* len_p, I32* flags, NV *result)
 
 =for hackers
 Found in file numeric.c
@@ -2107,7 +2130,7 @@ is NULL).
 If C<PERL_SCAN_ALLOW_UNDERSCORES> is set in I<*flags> then the octal
 number may use '_' characters to separate digits.
 
-       UV      grok_oct(char* start, STRLEN* len, I32* flags, NV *result)
+       UV      grok_oct(const char* start, STRLEN* len_p, I32* flags, NV *result)
 
 =for hackers
 Found in file numeric.c
@@ -2116,7 +2139,7 @@ Found in file numeric.c
 
 For backwards compatibility. Use C<grok_bin> instead.
 
-       NV      scan_bin(char* start, STRLEN len, STRLEN* retlen)
+       NV      scan_bin(const char* start, STRLEN len, STRLEN* retlen)
 
 =for hackers
 Found in file numeric.c
@@ -2125,7 +2148,7 @@ Found in file numeric.c
 
 For backwards compatibility. Use C<grok_hex> instead.
 
-       NV      scan_hex(char* start, STRLEN len, STRLEN* retlen)
+       NV      scan_hex(const char* start, STRLEN len, STRLEN* retlen)
 
 =for hackers
 Found in file numeric.c
@@ -2134,7 +2157,7 @@ Found in file numeric.c
 
 For backwards compatibility. Use C<grok_oct> instead.
 
-       NV      scan_oct(char* start, STRLEN len, STRLEN* retlen)
+       NV      scan_oct(const char* start, STRLEN len, STRLEN* retlen)
 
 =for hackers
 Found in file numeric.c
@@ -2164,7 +2187,7 @@ Found in file op.c
 Creates a constant sub equivalent to Perl C<sub FOO () { 123 }> which is
 eligible for inlining at compile-time.
 
-       CV*     newCONSTSUB(HV* stash, char* name, SV* sv)
+       CV*     newCONSTSUB(HV* stash, const char* name, SV* sv)
 
 =for hackers
 Found in file op.c
@@ -2196,6 +2219,53 @@ Found in file pad.c
 
 =back
 
+=head1 Simple Exception Handling Macros
+
+=over 8
+
+=item dXCPT
+
+Set up neccessary local variables for exception handling.
+See L<perlguts/"Exception Handling">.
+
+               dXCPT;
+
+=for hackers
+Found in file XSUB.h
+
+=item XCPT_CATCH
+
+Introduces a catch block.  See L<perlguts/"Exception Handling">.
+
+=for hackers
+Found in file XSUB.h
+
+=item XCPT_RETHROW
+
+Rethrows a previously caught exception.  See L<perlguts/"Exception Handling">.
+
+               XCPT_RETHROW;
+
+=for hackers
+Found in file XSUB.h
+
+=item XCPT_TRY_END
+
+Ends a try block.  See L<perlguts/"Exception Handling">.
+
+=for hackers
+Found in file XSUB.h
+
+=item XCPT_TRY_START
+
+Starts a try block.  See L<perlguts/"Exception Handling">.
+
+=for hackers
+Found in file XSUB.h
+
+
+=back
+
 =head1 Stack Manipulation Macros
 
 =over 8
@@ -2872,6 +2942,17 @@ macro.
 =for hackers
 Found in file sv.c
 
+=item newSVhek
+
+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 the hek is NULL.
+
+       SV*     newSVhek(const HEK *hek)
+
+=for hackers
+Found in file sv.c
+
 =item newSViv
 
 Creates a new SV and copies an integer into it.  The reference count for the
@@ -2927,12 +3008,12 @@ Found in file sv.c
 
 =item newSVpvn_share
 
-Creates a new SV with its SvPVX pointing to a shared string in the string
+Creates a new SV with its SvPVX_const 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 READONLY and FAKE.  The string's hash is stored in the UV
 slot of the SV; if the C<hash> parameter is non-zero, that value is used;
 otherwise the hash is computed.  The idea here is that as the string table
-is used for shared hash keys these strings will have SvPVX == HeKEY and
+is used for shared hash keys these strings will have SvPVX_const == HeKEY and
 hash lookup will avoid string compare.
 
        SV*     newSVpvn_share(const char* s, I32 len, U32 hash)
@@ -2983,7 +3064,8 @@ Found in file sv.h
 
 =item SvCUR_set
 
-Set the length of the string which is in the SV.  See C<SvCUR>.
+Set the current length of the string which is in the SV.  See C<SvCUR>
+and C<SvIV_set>.
 
        void    SvCUR_set(SV* sv, STRLEN len)
 
@@ -3116,6 +3198,16 @@ version which guarantees to evaluate sv only once.
 =for hackers
 Found in file sv.h
 
+=item SvIVX
+
+Returns the raw value in the SV's IV slot, without checks or conversions.
+Only use when you are sure SvIOK is true. See also C<SvIV()>.
+
+       IV      SvIVX(SV* sv)
+
+=for hackers
+Found in file sv.h
+
 =item SvIVx
 
 Coerces the given SV to an integer and returns it. Guarantees to evaluate
@@ -3126,21 +3218,23 @@ sv only once. Use the more efficient C<SvIV> otherwise.
 =for hackers
 Found in file sv.h
 
-=item SvIVX
+=item SvIV_nomg
 
-Returns the raw value in the SV's IV slot, without checks or conversions.
-Only use when you are sure SvIOK is true. See also C<SvIV()>.
+Like C<SvIV> but doesn't process magic.
 
-       IV      SvIVX(SV* sv)
+       IV      SvIV_nomg(SV* sv)
 
 =for hackers
 Found in file sv.h
 
-=item SvIV_nomg
+=item SvIV_set
 
-Like C<SvIV> but doesn't process magic.
+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<SvIVX>.
+With future Perls, however, it will be more efficient to use 
+C<SvIV_set> instead of the lvalue assignment to C<SvIVX>.
 
-       IV      SvIV_nomg(SV* sv)
+       void    SvIV_set(SV* sv, IV val)
 
 =for hackers
 Found in file sv.h
@@ -3155,6 +3249,24 @@ attributable to C<SvOOK>.  See C<SvCUR>.
 =for hackers
 Found in file sv.h
 
+=item SvLEN_set
+
+Set the actual length of the string which is in the SV.  See C<SvIV_set>.
+
+       void    SvLEN_set(SV* sv, STRLEN len)
+
+=for hackers
+Found in file sv.h
+
+=item SvMAGIC_set
+
+Set the value of the MAGIC pointer in sv to val.  See C<SvIV_set>.
+
+       void    SvMAGIC_set(SV* sv, MAGIC* val)
+
+=for hackers
+Found in file sv.h
+
 =item SvNIOK
 
 Returns a boolean indicating whether the SV contains a number, integer or
@@ -3260,6 +3372,15 @@ sv only once. Use the more efficient C<SvNV> otherwise.
 =for hackers
 Found in file sv.h
 
+=item SvNV_set
+
+Set the value of the NV pointer in sv to val.  See C<SvIV_set>.
+
+       void    SvNV_set(SV* sv, NV val)
+
+=for hackers
+Found in file sv.h
+
 =item SvOK
 
 Returns a boolean indicating whether the value is an SV. It also tells
@@ -3450,21 +3571,21 @@ Like C<SvPV_nolen>, but converts sv to utf8 first if necessary.
 =for hackers
 Found in file sv.h
 
-=item SvPVx
+=item SvPVX
 
-A version of C<SvPV> which guarantees to evaluate sv only once.
+Returns a pointer to the physical string in the SV.  The SV must contain a
+string.
 
-       char*   SvPVx(SV* sv, STRLEN len)
+       char*   SvPVX(SV* sv)
 
 =for hackers
 Found in file sv.h
 
-=item SvPVX
+=item SvPVx
 
-Returns a pointer to the physical string in the SV.  The SV must contain a
-string.
+A version of C<SvPV> which guarantees to evaluate sv only once.
 
-       char*   SvPVX(SV* sv)
+       char*   SvPVx(SV* sv, STRLEN len)
 
 =for hackers
 Found in file sv.h
@@ -3511,6 +3632,15 @@ Like C<SvPV> but doesn't process magic.
 =for hackers
 Found in file sv.h
 
+=item SvPV_set
+
+Set the value of the PV pointer in sv to val.  See C<SvIV_set>.
+
+       void    SvPV_set(SV* sv, char* val)
+
+=for hackers
+Found in file sv.h
+
 =item SvREFCNT
 
 Returns the value of the object's reference count.
@@ -3574,6 +3704,15 @@ Dereferences an RV to return the SV.
 =for hackers
 Found in file sv.h
 
+=item SvRV_set
+
+Set the value of the RV pointer in sv to val.  See C<SvIV_set>.
+
+       void    SvRV_set(SV* sv, SV* val)
+
+=for hackers
+Found in file sv.h
+
 =item SvSTASH
 
 Returns the stash of the SV.
@@ -3583,6 +3722,15 @@ Returns the stash of the SV.
 =for hackers
 Found in file sv.h
 
+=item SvSTASH_set
+
+Set the value of the STASH pointer in sv to val.  See C<SvIV_set>.
+
+       void    SvSTASH_set(SV* sv, STASH* val)
+
+=for hackers
+Found in file sv.h
+
 =item SvTAINT
 
 Taints an SV if tainting is enabled.
@@ -3730,6 +3878,15 @@ Like C<SvUV> but doesn't process magic.
 =for hackers
 Found in file sv.h
 
+=item SvUV_set
+
+Set the value of the UV pointer in sv to val.  See C<SvIV_set>.
+
+       void    SvUV_set(SV* sv, UV val)
+
+=for hackers
+Found in file sv.h
+
 =item SvVOK
 
 Returns a boolean indicating whether the SV contains a v-string.
@@ -3925,9 +4082,9 @@ Processes its arguments like C<sprintf> and appends the formatted
 output to an SV.  If the appended data contains "wide" characters
 (including, but not limited to, SVs with a UTF-8 PV formatted with %s,
 and characters >255 formatted with %c), the original SV might get
-upgraded to UTF-8.  Handles 'get' magic, but not 'set' magic.
-C<SvSETMAGIC()> must typically be called after calling this function
-to handle 'set' magic.
+upgraded to UTF-8.  Handles 'get' magic, but not 'set' magic.  See
+C<sv_catpvf_mg>. 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.
 
        void    sv_catpvf(SV* sv, const char* pat, ...)
 
@@ -3978,6 +4135,15 @@ Like C<sv_catpvn>, but also handles 'set' magic.
 =for hackers
 Found in file sv.c
 
+=item sv_catpvn_nomg
+
+Like C<sv_catpvn> but doesn't process magic.
+
+       void    sv_catpvn_nomg(SV* sv, const char* ptr, STRLEN len)
+
+=for hackers
+Found in file sv.h
+
 =item sv_catpv_mg
 
 Like C<sv_catpv>, but also handles 'set' magic.
@@ -4019,16 +4185,25 @@ Like C<sv_catsv>, but also handles 'set' magic.
 =for hackers
 Found in file sv.c
 
+=item sv_catsv_nomg
+
+Like C<sv_catsv> but doesn't process magic.
+
+       void    sv_catsv_nomg(SV* dsv, SV* ssv)
+
+=for hackers
+Found in file sv.h
+
 =item sv_chop
 
 Efficient removal of characters from the beginning of the string buffer.
 SvPOK(sv) must be true and the C<ptr> must be a pointer to somewhere inside
 the string buffer.  The C<ptr> becomes the first character of the adjusted
 string. Uses the "OOK hack".
-Beware: after this function returns, C<ptr> and SvPVX(sv) may no longer
+Beware: after this function returns, C<ptr> and SvPVX_const(sv) may no longer
 refer to the same chunk of data.
 
-       void    sv_chop(SV* sv, char* ptr)
+       void    sv_chop(SV* sv, const char* ptr)
 
 =for hackers
 Found in file sv.c
@@ -4208,7 +4383,7 @@ Found in file sv.c
 Inserts a string at the specified offset/length within the SV. Similar to
 the Perl substr() function.
 
-       void    sv_insert(SV* bigsv, STRLEN offset, STRLEN len, char* little, STRLEN littlelen)
+       void    sv_insert(SV* bigsv, STRLEN offset, STRLEN len, const char* little, STRLEN littlelen)
 
 =for hackers
 Found in file sv.c
@@ -4270,6 +4445,12 @@ Found in file sv.c
 Adds magic to an SV. First upgrades C<sv> to type C<SVt_PVMG> if necessary,
 then adds a new magic item of type C<how> to the head of the magic list.
 
+See C<sv_magicext> (which C<sv_magic> now calls) for a description of the
+handling of the C<name> and C<namlen> arguments.
+
+You need to use C<sv_magicext> to add magic to SvREADONLY SVs and also
+to add more than one instance of the same 'how'.
+
        void    sv_magic(SV* sv, SV* obj, int how, const char* name, I32 namlen)
 
 =for hackers
@@ -4278,20 +4459,20 @@ Found in file sv.c
 =item sv_magicext
 
 Adds magic to an SV, upgrading it if necessary. Applies the
-supplied vtable and returns pointer to the magic added.
+supplied vtable and returns pointer to the magic added.
 
-Note that sv_magicext will allow things that sv_magic will not.
-In particular you can add magic to SvREADONLY SVs and and more than
-one instance of the same 'how'
+Note that C<sv_magicext> will allow things that C<sv_magic> will not.
+In particular, you can add magic to SvREADONLY SVs, and add more than
+one instance of the same 'how'.
 
-I C<namelen> is greater then zero then a savepvn() I<copy> of C<name> is stored,
-if C<namelen> is zero then C<name> is stored as-is and - as another special
-case - if C<(name && namelen == HEf_SVKEY)> then C<name> is assumed to contain
-an C<SV*> and has its REFCNT incremented
+If C<namlen> is greater than zero then a C<savepvn> I<copy> of C<name> is
+stored, if C<namlen> is zero then C<name> is stored as-is and - as another
+special case - if C<(name && namlen == HEf_SVKEY)> then C<name> is assumed
+to contain an C<SV*> and is stored as-is with its REFCNT incremented.
 
-(This is now used as a subroutine by sv_magic.)
+(This is now used as a subroutine by C<sv_magic>.)
 
-       MAGIC * sv_magicext(SV* sv, SV* obj, int how, MGVTBL *vtbl, const char* name, I32 namlen        )
+       MAGIC * sv_magicext(SV* sv, SV* obj, int how, const MGVTBL *vtbl, const char* name, I32 namlen)
 
 =for hackers
 Found in file sv.c
@@ -4474,7 +4655,7 @@ Found in file sv.c
 
 Returns a string describing what the SV is a reference to.
 
-       char*   sv_reftype(SV* sv, int ob)
+       char*   sv_reftype(const SV* sv, int ob)
 
 =for hackers
 Found in file sv.c
@@ -4507,7 +4688,7 @@ Found in file sv.c
 Underlying implementation for the C<reset> Perl function.
 Note that the perl-level function is vaguely deprecated.
 
-       void    sv_reset(char* s, HV* stash)
+       void    sv_reset(const char* s, HV* stash)
 
 =for hackers
 Found in file sv.c
@@ -4574,8 +4755,8 @@ Found in file sv.c
 
 =item sv_setpvf
 
-Processes its arguments like C<sprintf> and sets an SV to the formatted
-output.  Does not handle 'set' magic.  See C<sv_setpvf_mg>.
+Works like C<sv_catpvf> but copies the text into the SV instead of
+appending it.  Does not handle 'set' magic.  See C<sv_setpvf_mg>.
 
        void    sv_setpvf(SV* sv, const char* pat, ...)
 
@@ -4738,8 +4919,9 @@ function if the source SV needs to be reused. Does not handle 'set' magic.
 Loosely speaking, it performs a copy-by-value, obliterating any previous
 content of the destination.
 If the C<flags> parameter has the C<SV_GMAGIC> bit set, will C<mg_get> on
-C<ssv> if appropriate, else not. C<sv_setsv> and C<sv_setsv_nomg> are
-implemented in terms of this function.
+C<ssv> if appropriate, else not. If the C<flags> parameter has the
+C<NOSTEAL> bit set then the buffers of temps will not be stolen. <sv_setsv>
+and C<sv_setsv_nomg> are implemented in terms of this function.
 
 You probably want to use one of the assortment of wrappers, such as
 C<SvSetSV>, C<SvSetSV_nosteal>, C<SvSetMagicSV> and
@@ -4762,6 +4944,15 @@ Like C<sv_setsv>, but also handles 'set' magic.
 =for hackers
 Found in file sv.c
 
+=item sv_setsv_nomg
+
+Like C<sv_setsv> but doesn't process magic.
+
+       void    sv_setsv_nomg(SV* dsv, SV* ssv)
+
+=for hackers
+Found in file sv.h
+
 =item sv_setuv
 
 Copies an unsigned integer into the given SV, upgrading first if necessary.
@@ -4973,6 +5164,18 @@ cope with complex macro expressions. Always use the macro instead.
 =for hackers
 Found in file sv.c
 
+=item sv_vcatpvf
+
+Processes its arguments like C<vsprintf> and appends the formatted output
+to an SV.  Does not handle 'set' magic.  See C<sv_vcatpvf_mg>.
+
+Usually used via its frontend C<sv_catpvf>.
+
+       void    sv_vcatpvf(SV* sv, const char* pat, va_list* args)
+
+=for hackers
+Found in file sv.c
+
 =item sv_vcatpvfn
 
 Processes its arguments like C<vsprintf> and appends the formatted output
@@ -4981,25 +5184,59 @@ missing (NULL).  When running with taint checks enabled, indicates via
 C<maybe_tainted> if results are untrustworthy (often due to the use of
 locales).
 
-Usually used via one of its frontends C<sv_catpvf> and C<sv_catpvf_mg>.
+Usually used via one of its frontends C<sv_vcatpvf> and C<sv_vcatpvf_mg>.
 
        void    sv_vcatpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
 
 =for hackers
 Found in file sv.c
 
+=item sv_vcatpvf_mg
+
+Like C<sv_vcatpvf>, but also handles 'set' magic.
+
+Usually used via its frontend C<sv_catpvf_mg>.
+
+       void    sv_vcatpvf_mg(SV* sv, const char* pat, va_list* args)
+
+=for hackers
+Found in file sv.c
+
+=item sv_vsetpvf
+
+Works like C<sv_vcatpvf> but copies the text into the SV instead of
+appending it.  Does not handle 'set' magic.  See C<sv_vsetpvf_mg>.
+
+Usually used via its frontend C<sv_setpvf>.
+
+       void    sv_vsetpvf(SV* sv, const char* pat, va_list* args)
+
+=for hackers
+Found in file sv.c
+
 =item sv_vsetpvfn
 
-Works like C<vcatpvfn> but copies the text into the SV instead of
+Works like C<sv_vcatpvfn> but copies the text into the SV instead of
 appending it.
 
-Usually used via one of its frontends C<sv_setpvf> and C<sv_setpvf_mg>.
+Usually used via one of its frontends C<sv_vsetpvf> and C<sv_vsetpvf_mg>.
 
        void    sv_vsetpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
 
 =for hackers
 Found in file sv.c
 
+=item sv_vsetpvf_mg
+
+Like C<sv_vsetpvf>, but also handles 'set' magic.
+
+Usually used via its frontend C<sv_setpvf_mg>.
+
+       void    sv_vsetpvf_mg(SV* sv, const char* pat, va_list* args)
+
+=for hackers
+Found in file sv.c
+
 
 =back
 
@@ -5010,7 +5247,7 @@ Found in file sv.c
 =item bytes_from_utf8
 
 Converts a string C<s> of length C<len> from UTF-8 into byte encoding.
-Unlike <utf8_to_bytes> but like C<bytes_to_utf8>, returns a pointer to
+Unlike C<utf8_to_bytes> but like C<bytes_to_utf8>, returns a pointer to
 the newly-created string, and updates C<len> to contain the new
 length.  Returns the original string if no conversion occurs, C<len>
 is unchanged. Do nothing if C<is_utf8> points to 0. Sets C<is_utf8> to
@@ -5019,7 +5256,7 @@ is unchanged. Do nothing if C<is_utf8> points to 0. Sets C<is_utf8> to
 NOTE: this function is experimental and may change or be
 removed without notice.
 
-       U8*     bytes_from_utf8(U8 *s, STRLEN *len, bool *is_utf8)
+       U8*     bytes_from_utf8(const U8 *s, STRLEN *len, bool *is_utf8)
 
 =for hackers
 Found in file utf8.c
@@ -5036,7 +5273,7 @@ see sv_recode_to_utf8().
 NOTE: this function is experimental and may change or be
 removed without notice.
 
-       U8*     bytes_to_utf8(U8 *s, STRLEN *len)
+       U8*     bytes_to_utf8(const U8 *s, STRLEN *len)
 
 =for hackers
 Found in file utf8.c
@@ -5054,7 +5291,7 @@ If the pe1 and pe2 are non-NULL, the scanning pointers will be copied
 in there (they will point at the beginning of the I<next> character).
 If the pointers behind pe1 or pe2 are non-NULL, they are the end
 pointers beyond which scanning will not continue under any
-circustances.  If the byte lengths l1 and l2 are non-zero, s1+l1 and
+circumstances.  If the byte lengths l1 and l2 are non-zero, s1+l1 and
 s2+l2 will be used as goal end pointers that will also stop the scan,
 and which qualify towards defining a successful match: all the scans
 that define an explicit length must reach their goal pointers for
@@ -5076,7 +5313,7 @@ character.  Note that an INVARIANT (i.e. ASCII) character is a valid
 UTF-8 character.  The actual number of bytes in the UTF-8 character
 will be returned if it is valid, otherwise 0.
 
-       STRLEN  is_utf8_char(U8 *p)
+       STRLEN  is_utf8_char(const U8 *p)
 
 =for hackers
 Found in file utf8.c
@@ -5088,17 +5325,36 @@ UTF-8 string, false otherwise.  Note that 'a valid UTF-8 string' does
 not mean 'a string that contains code points above 0x7F encoded in UTF-8'
 because a valid ASCII string is a valid UTF-8 string.
 
-       bool    is_utf8_string(U8 *s, STRLEN len)
+See also is_utf8_string_loclen() and is_utf8_string_loc().
+
+       bool    is_utf8_string(const U8 *s, STRLEN len)
 
 =for hackers
 Found in file utf8.c
 
 =item is_utf8_string_loc
 
-Like is_ut8_string but store the location of the failure in
-the last argument.
+Like is_ut8_string() but stores the location of the failure (in the
+case of "utf8ness failure") or the location s+len (in the case of
+"utf8ness success") in the C<ep>.
+
+See also is_utf8_string_loclen() and is_utf8_string().
+
+       bool    is_utf8_string_loc(const U8 *s, STRLEN len, const U8 **p)
+
+=for hackers
+Found in file utf8.c
+
+=item is_utf8_string_loclen
 
-       bool    is_utf8_string_loc(U8 *s, STRLEN len, U8 **p)
+Like is_ut8_string() but stores the location of the failure (in the
+case of "utf8ness failure") or the location s+len (in the case of
+"utf8ness success") in the C<ep>, and the number of UTF-8
+encoded characters in the C<el>.
+
+See also is_utf8_string_loc() and is_utf8_string().
+
+       bool    is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
 
 =for hackers
 Found in file utf8.c
@@ -5118,7 +5374,7 @@ UNI_DISPLAY_BACKSLASH and UNI_DISPLAY_ISPRINT turned on.
 
 The pointer to the PV of the dsv is returned.
 
-       char*   pv_uni_display(SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
+       char*   pv_uni_display(SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
 
 =for hackers
 Found in file utf8.c
@@ -5195,7 +5451,7 @@ Perl_to_utf8_case().
 The "normal" is a string like "ToLower" which means the swash
 %utf8::ToLower.
 
-       UV      to_utf8_case(U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, char *normal, char *special)
+       UV      to_utf8_case(const U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, const char *normal, const char *special)
 
 =for hackers
 Found in file utf8.c
@@ -5204,14 +5460,14 @@ Found in file utf8.c
 
 Convert the UTF-8 encoded character at p to its foldcase version and
 store that in UTF-8 in ustrp and its length in bytes in lenp.  Note
-that the ustrp needs to be at least UTF8_MAXLEN_FOLD+1 bytes since the
+that the ustrp needs to be at least UTF8_MAXBYTES_CASE+1 bytes since the
 foldcase version may be longer than the original character (up to
 three characters).
 
 The first character of the foldcased version is returned
 (but note, as explained above, that there may be more.)
 
-       UV      to_utf8_fold(U8 *p, U8* ustrp, STRLEN *lenp)
+       UV      to_utf8_fold(const U8 *p, U8* ustrp, STRLEN *lenp)
 
 =for hackers
 Found in file utf8.c
@@ -5220,14 +5476,13 @@ Found in file utf8.c
 
 Convert the UTF-8 encoded character at p to its lowercase version and
 store that in UTF-8 in ustrp and its length in bytes in lenp.  Note
-that the ustrp needs to be at least UTF8_MAXLEN_UCLC+1 bytes since the
-lowercase version may be longer than the original character (up to two
-characters).
+that the ustrp needs to be at least UTF8_MAXBYTES_CASE+1 bytes since the
+lowercase version may be longer than the original character.
 
 The first character of the lowercased version is returned
 (but note, as explained above, that there may be more.)
 
-       UV      to_utf8_lower(U8 *p, U8* ustrp, STRLEN *lenp)
+       UV      to_utf8_lower(const U8 *p, U8* ustrp, STRLEN *lenp)
 
 =for hackers
 Found in file utf8.c
@@ -5236,14 +5491,13 @@ Found in file utf8.c
 
 Convert the UTF-8 encoded character at p to its titlecase version and
 store that in UTF-8 in ustrp and its length in bytes in lenp.  Note
-that the ustrp needs to be at least UTF8_MAXLEN_UCLC+1 bytes since the
-titlecase version may be longer than the original character (up to two
-characters).
+that the ustrp needs to be at least UTF8_MAXBYTES_CASE+1 bytes since the
+titlecase version may be longer than the original character.
 
 The first character of the titlecased version is returned
 (but note, as explained above, that there may be more.)
 
-       UV      to_utf8_title(U8 *p, U8* ustrp, STRLEN *lenp)
+       UV      to_utf8_title(const U8 *p, U8* ustrp, STRLEN *lenp)
 
 =for hackers
 Found in file utf8.c
@@ -5252,14 +5506,13 @@ Found in file utf8.c
 
 Convert the UTF-8 encoded character at p to its uppercase version and
 store that in UTF-8 in ustrp and its length in bytes in lenp.  Note
-that the ustrp needs to be at least UTF8_MAXLEN_UCLC+1 bytes since the
-uppercase version may be longer than the original character (up to two
-characters).
+that the ustrp needs to be at least UTF8_MAXBYTES_CASE+1 bytes since
+the uppercase version may be longer than the original character.
 
 The first character of the uppercased version is returned
 (but note, as explained above, that there may be more.)
 
-       UV      to_utf8_upper(U8 *p, U8* ustrp, STRLEN *lenp)
+       UV      to_utf8_upper(const U8 *p, U8* ustrp, STRLEN *lenp)
 
 =for hackers
 Found in file utf8.c
@@ -5272,7 +5525,7 @@ length, in bytes, of that character.
 
 Allows length and flags to be passed to low level routine.
 
-       UV      utf8n_to_uvchr(U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags)
+       UV      utf8n_to_uvchr(const U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags)
 
 =for hackers
 Found in file utf8.c
@@ -5297,7 +5550,7 @@ the strict UTF-8 encoding (see F<utf8.h>).
 
 Most code should use utf8_to_uvchr() rather than call this directly.
 
-       UV      utf8n_to_uvuni(U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags)
+       UV      utf8n_to_uvuni(const U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags)
 
 =for hackers
 Found in file utf8.c
@@ -5310,7 +5563,7 @@ and C<b>.
 WARNING: use only if you *know* that the pointers point inside the
 same UTF-8 buffer.
 
-       IV      utf8_distance(U8 *a, U8 *b)
+       IV      utf8_distance(const U8 *a, const U8 *b)
 
 =for hackers
 Found in file utf8.c
@@ -5324,7 +5577,7 @@ WARNING: do not use the following unless you *know* C<off> is within
 the UTF-8 data pointed to by C<s> *and* that on entry C<s> is aligned
 on the first byte of character or just after the last byte of a character.
 
-       U8*     utf8_hop(U8 *s, I32 off)
+       U8*     utf8_hop(const U8 *s, I32 off)
 
 =for hackers
 Found in file utf8.c
@@ -5335,7 +5588,7 @@ Return the length of the UTF-8 char encoded string C<s> in characters.
 Stops at C<e> (inclusive).  If C<e E<lt> s> or if the scan would end
 up past C<e>, croaks.
 
-       STRLEN  utf8_length(U8* s, U8 *e)
+       STRLEN  utf8_length(const U8* s, const U8 *e)
 
 =for hackers
 Found in file utf8.c
@@ -5364,7 +5617,7 @@ length, in bytes, of that character.
 If C<s> does not point to a well-formed UTF-8 character, zero is
 returned and retlen is set, if possible, to -1.
 
-       UV      utf8_to_uvchr(U8 *s, STRLEN* retlen)
+       UV      utf8_to_uvchr(const U8 *s, STRLEN* retlen)
 
 =for hackers
 Found in file utf8.c
@@ -5381,7 +5634,7 @@ an index into the Unicode semantic tables (e.g. swashes).
 If C<s> does not point to a well-formed UTF-8 character, zero is
 returned and retlen is set, if possible, to -1.
 
-       UV      utf8_to_uvuni(U8 *s, STRLEN* retlen)
+       UV      utf8_to_uvuni(const U8 *s, STRLEN* retlen)
 
 =for hackers
 Found in file utf8.c
@@ -5389,7 +5642,7 @@ Found in file utf8.c
 =item uvchr_to_utf8
 
 Adds the UTF-8 representation of the Native codepoint C<uv> to the end
-of the string C<d>; C<d> should be have at least C<UTF8_MAXLEN+1> free
+of the string C<d>; C<d> should be have at least C<UTF8_MAXBYTES+1> free
 bytes available. The return value is the pointer to the byte after the
 end of the new character. In other words,
 
@@ -5407,7 +5660,7 @@ Found in file utf8.c
 =item uvuni_to_utf8_flags
 
 Adds the UTF-8 representation of the Unicode codepoint C<uv> to the end
-of the string C<d>; C<d> should be have at least C<UTF8_MAXLEN+1> free
+of the string C<d>; C<d> should be have at least C<UTF8_MAXBYTES+1> free
 bytes available. The return value is the pointer to the byte after the
 end of the new character. In other words,
 
@@ -5468,6 +5721,16 @@ This is usually handled automatically by C<xsubpp> by calling C<dXSARGS>.
 =for hackers
 Found in file XSUB.h
 
+=item dAXMARK
+
+Sets up the C<ax> variable and stack marker variable C<mark>.
+This is usually handled automatically by C<xsubpp> by calling C<dXSARGS>.
+
+               dAXMARK;
+
+=for hackers
+Found in file XSUB.h
+
 =item dITEMS
 
 Sets up the C<items> variable.