- get_sv
-
Returns the SV of the specified Perl scalar. If create is set and the Perl
variable does not exist then it will be created. If create is not set and the
variable does not exist then NULL is returned.
NOTE: the perl_ form of this function is deprecated.
SV* get_sv(const char* name, I32 create)
|
|
- looks_like_number
-
Test if the content of an SV looks like a number (or is a number). Inf and
Infinity are treated as numbers (so will not issue a non-numeric warning),
even if your atof() doesn't grok them.
I32 looks_like_number(SV* sv)
|
|
- newRV_inc
-
Creates an RV wrapper for an SV. The reference count for the original SV is
incremented.
- newRV_noinc
-
Creates an RV wrapper for an SV. The reference count for the original SV is not
incremented.
- newSV
-
Create a new null SV, or if len > 0, create a new empty SVt_PV type SV with an
initial PV allocation of len+1. Normally accessed via the NEWSV macro.
- newSViv
-
Creates a new SV and copies an integer into it. The reference count for the SV is set
to 1.
- newSVnv
-
Creates a new SV and copies a floating point value into it. The reference count for the
SV is set to 1.
- newSVpv
-
Creates a new SV and copies a string into it. The reference count for the SV is set to
1. If len is zero, Perl will compute the length using strlen(). For
efficiency, consider using newSVpvn instead.
SV* newSVpv(const char* s, STRLEN len)
|
|
- newSVpvf
-
Creates a new SV and initializes it with the string formatted like sprintf.
SV* newSVpvf(const char* pat, ...)
|
|
- newSVpvn
-
Creates a new SV and copies a string into it. The reference count for the SV is set to
1. Note that if len is zero, Perl will create a zero length string. You are
responsible for ensuring that the source string is at least len bytes long.
SV* newSVpvn(const char* s, STRLEN len)
|
|
- newSVpvn_share
-
Creates a new SV with its SvPVX 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 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 hash lookup will avoid string compare.
SV* newSVpvn_share(const char* s, I32 len, U32 hash)
|
|
- newSVrv
-
Creates a new SV for the RV, rv, to point to. If rv is not an
RV then it will be upgraded to one. If classname 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.
SV* newSVrv(SV* rv, const char* classname)
|
|
- newSVsv
-
Creates a new SV which is an exact duplicate of the original SV. (Uses sv_setsv).
- newSVuv
-
Creates a new SV and copies an unsigned integer into it. The reference count for the SV
is set to 1.
- new_vstring
-
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 = NEWSV(92,5);
s = new_vstring(s,sv);
|
|
The sv must already be large enough to store the vstring passed in.
char* new_vstring(char *vstr, SV *sv)
|
|
- SvCUR
-
Returns the length of the string which is in the SV. See SvLEN.
- SvCUR_set
-
Set the length of the string which is in the SV. See SvCUR.
void SvCUR_set(SV* sv, STRLEN len)
|
|
- SvEND
-
Returns a pointer to the last character in the string which is in the SV. See SvCUR.
Access the character as *(SvEND(sv)).
- SvGROW
-
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 NUL character). Calls sv_grow
to perform the expansion if necessary. Returns a pointer to the character buffer.
char * SvGROW(SV* sv, STRLEN len)
|
|
- SvIOK
-
Returns a boolean indicating whether the SV contains an integer.
- SvIOKp
-
Returns a boolean indicating whether the SV contains an integer. Checks the private
setting. Use SvIOK.
- SvIOK_notUV
-
Returns a boolean indicating whether the SV contains a signed integer.
- SvIOK_off
-
Unsets the IV status of an SV.
- SvIOK_on
-
Tells an SV that it is an integer.
- SvIOK_only
-
Tells an SV that it is an integer and disables all other OK bits.
- SvIOK_only_UV
-
Tells and SV that it is an unsigned integer and disables all other OK bits.
void SvIOK_only_UV(SV* sv)
|
|
- SvIOK_UV
-
Returns a boolean indicating whether the SV contains an unsigned integer.
- SvIV
-
Coerces the given SV to an integer and returns it. See SvIVx for a version
which guarantees to evaluate sv only once.
- SvIVx
-
Coerces the given SV to an integer and returns it. Guarantees to evaluate sv only once.
Use the more efficient SvIV otherwise.
- 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 SvIV().
- SvLEN
-
Returns the size of the string buffer in the SV, not including any part attributable to
SvOOK. See SvCUR.
- SvNIOK
-
Returns a boolean indicating whether the SV contains a number, integer or double.
- SvNIOKp
-
Returns a boolean indicating whether the SV contains a number, integer or double.
Checks the private setting. Use SvNIOK.
- SvNIOK_off
-
Unsets the NV/IV status of an SV.
- SvNOK
-
Returns a boolean indicating whether the SV contains a double.
- SvNOKp
-
Returns a boolean indicating whether the SV contains a double. Checks the private
setting. Use SvNOK.
- SvNOK_off
-
Unsets the NV status of an SV.
- SvNOK_on
-
Tells an SV that it is a double.
- SvNOK_only
-
Tells an SV that it is a double and disables all other OK bits.
- SvNV
-
Coerce the given SV to a double and return it. See SvNVx for a version
which guarantees to evaluate sv only once.
- SvNVX
-
Returns the raw value in the SV's NV slot, without checks or conversions. Only use when
you are sure SvNOK is true. See also SvNV().
- SvNVx
-
Coerces the given SV to a double and returns it. Guarantees to evaluate sv only once.
Use the more efficient SvNV otherwise.
- SvOK
-
Returns a boolean indicating whether the value is an SV.
- SvOOK
-
Returns a boolean indicating whether the SvIVX is a valid offset value for the SvPVX.
This hack is used internally to speed up removal of characters from the beginning of a
SvPV. When SvOOK is true, then the start of the allocated string buffer is really (SvPVX -
SvIVX).
- SvPOK
-
Returns a boolean indicating whether the SV contains a character string.
- SvPOKp
-
Returns a boolean indicating whether the SV contains a character string. Checks the private
setting. Use SvPOK.
- SvPOK_off
-
Unsets the PV status of an SV.
- SvPOK_on
-
Tells an SV that it is a string.
- SvPOK_only
-
Tells an SV that it is a string and disables all other OK bits. Will also turn off the
UTF8 status.
- SvPOK_only_UTF8
-
Tells an SV that it is a string and disables all other OK bits, and leaves the UTF8
status as it was.
void SvPOK_only_UTF8(SV* sv)
|
|
- SvPV
-
Returns a pointer to the string in the SV, or a stringified form of the SV if the SV
does not contain a string. The SV may cache the stringified version becoming SvPOK.
Handles 'get' magic. See also SvPVx for a version which guarantees to
evaluate sv only once.
char* SvPV(SV* sv, STRLEN len)
|
|
- SvPVbyte
-
Like SvPV, but converts sv to byte representation first if necessary.
char* SvPVbyte(SV* sv, STRLEN len)
|
|
- SvPVbytex
-
Like SvPV, but converts sv to byte representation first if necessary.
Guarantees to evaluate sv only once; use the more efficient SvPVbyte
otherwise.
char* SvPVbytex(SV* sv, STRLEN len)
|
|
- SvPVbytex_force
-
Like SvPV_force, but converts sv to byte representation first if
necessary. Guarantees to evaluate sv only once; use the more efficient SvPVbyte_force
otherwise.
char* SvPVbytex_force(SV* sv, STRLEN len)
|
|
- SvPVbyte_force
-
Like SvPV_force, but converts sv to byte representation first if
necessary.
char* SvPVbyte_force(SV* sv, STRLEN len)
|
|
- SvPVbyte_nolen
-
Like SvPV_nolen, but converts sv to byte representation first if
necessary.
char* SvPVbyte_nolen(SV* sv)
|
|
- SvPVutf8
-
Like SvPV, but converts sv to utf8 first if necessary.
char* SvPVutf8(SV* sv, STRLEN len)
|
|
- SvPVutf8x
-
Like SvPV, but converts sv to utf8 first if necessary. Guarantees to
evaluate sv only once; use the more efficient SvPVutf8 otherwise.
char* SvPVutf8x(SV* sv, STRLEN len)
|
|
- SvPVutf8x_force
-
Like SvPV_force, but converts sv to utf8 first if necessary. Guarantees to
evaluate sv only once; use the more efficient SvPVutf8_force otherwise.
char* SvPVutf8x_force(SV* sv, STRLEN len)
|
|
- SvPVutf8_force
-
Like SvPV_force, but converts sv to utf8 first if necessary.
char* SvPVutf8_force(SV* sv, STRLEN len)
|
|
- SvPVutf8_nolen
-
Like SvPV_nolen, but converts sv to utf8 first if necessary.
char* SvPVutf8_nolen(SV* sv)
|
|
- SvPVx
-
A version of SvPV which guarantees to evaluate sv only once.
char* SvPVx(SV* sv, STRLEN len)
|
|
- SvPVX
-
Returns a pointer to the physical string in the SV. The SV must contain a string.
- SvPV_force
-
Like SvPV but will force the SV into containing just a string (SvPOK_only).
You want force if you are going to update the SvPVX directly.
char* SvPV_force(SV* sv, STRLEN len)
|
|
- SvPV_force_nomg
-
Like SvPV but will force the SV into containing just a string (SvPOK_only).
You want force if you are going to update the SvPVX directly. Doesn't process
magic.
char* SvPV_force_nomg(SV* sv, STRLEN len)
|
|
- SvPV_nolen
-
Returns a pointer to the string in the SV, or a stringified form of the SV if the SV
does not contain a string. The SV may cache the stringified form becoming SvPOK.
Handles 'get' magic.
- SvREFCNT
-
Returns the value of the object's reference count.
- SvREFCNT_dec
-
Decrements the reference count of the given SV.
void SvREFCNT_dec(SV* sv)
|
|
- SvREFCNT_inc
-
Increments the reference count of the given SV.
- SvROK
-
Tests if the SV is an RV.
- SvROK_off
-
Unsets the RV status of an SV.
- SvROK_on
-
Tells an SV that it is an RV.
- SvRV
-
Dereferences an RV to return the SV.
- SvSTASH
-
Returns the stash of the SV.
- SvTAINT
-
Taints an SV if tainting is enabled
- SvTAINTED
-
Checks to see if an SV is tainted. Returns TRUE if it is, FALSE if not.
- SvTAINTED_off
-
Untaints an SV. Be very 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.
void SvTAINTED_off(SV* sv)
|
|
- SvTAINTED_on
-
Marks an SV as tainted.
void SvTAINTED_on(SV* sv)
|
|
- SvTRUE
-
Returns a boolean indicating whether Perl would evaluate the SV as true or false,
defined or undefined. Does not handle 'get' magic.
- SvTYPE
-
Returns the type of the SV. See svtype.
- SvUNLOCK
-
Releases a mutual exclusion lock on sv if a suitable module has been loaded.
- SvUOK
-
Returns a boolean indicating whether the SV contains an unsigned integer.
- SvUPGRADE
-
Used to upgrade an SV to a more complex form. Uses sv_upgrade to perform
the upgrade if necessary. See svtype.
void SvUPGRADE(SV* sv, svtype type)
|
|
- SvUTF8
-
Returns a boolean indicating whether the SV contains UTF-8 encoded data.
- SvUTF8_off
-
Unsets the UTF8 status of an SV.
- SvUTF8_on
-
Turn on the UTF8 status of an SV (the data is not changed, just the flag). Do not use
frivolously.
- SvUV
-
Coerces the given SV to an unsigned integer and returns it. See SvUVx for
a version which guarantees to evaluate sv only once.
- SvUVX
-
Returns the raw value in the SV's UV slot, without checks or conversions. Only use when
you are sure SvIOK is true. See also SvUV().
- SvUVx
-
Coerces the given SV to an unsigned integer and returns it. Guarantees to evaluate sv
only once. Use the more efficient SvUV otherwise.
- sv_2bool
-
This function is only called on magical items, and is only used by sv_true() or its
macro equivalent.
- sv_2cv
-
Using various gambits, try to get a CV from an SV; in addition, try if possible to set *st
and *gvp to the stash and GV associated with it.
CV* sv_2cv(SV* sv, HV** st, GV** gvp, I32 lref)
|
|
- sv_2io
-
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.
- sv_2iv
-
Return the integer value of an SV, doing any necessary string conversion, magic etc.
Normally used via the SvIV(sv) and SvIVx(sv) macros.
- sv_2mortal
-
Marks an existing SV as mortal. The SV will be destroyed "soon", either by an
explicit call to FREETMPS, or by an implicit call at places such as statement boundaries.
See also sv_newmortal and sv_mortalcopy.
- sv_2nv
-
Return the num value of an SV, doing any necessary string or integer conversion, magic
etc. Normally used via the SvNV(sv) and SvNVx(sv) macros.
- sv_2pvbyte
-
Return a pointer to the byte-encoded representation of the SV, and set *lp to its
length. May cause the SV to be downgraded from UTF8 as a side-effect.
Usually accessed via the SvPVbyte macro.
char* sv_2pvbyte(SV* sv, STRLEN* lp)
|
|
- sv_2pvbyte_nolen
-
Return a pointer to the byte-encoded representation of the SV. May cause the SV to be
downgraded from UTF8 as a side-effect.
Usually accessed via the SvPVbyte_nolen macro.
char* sv_2pvbyte_nolen(SV* sv)
|
|
- sv_2pvutf8
-
Return a pointer to the UTF8-encoded representation of the SV, and set *lp to its
length. May cause the SV to be upgraded to UTF8 as a side-effect.
Usually accessed via the SvPVutf8 macro.
char* sv_2pvutf8(SV* sv, STRLEN* lp)
|
|
- sv_2pvutf8_nolen
-
Return a pointer to the UTF8-encoded representation of the SV. May cause the SV to be
upgraded to UTF8 as a side-effect.
Usually accessed via the SvPVutf8_nolen macro.
char* sv_2pvutf8_nolen(SV* sv)
|
|
- sv_2pv_flags
-
Returns a pointer to the string value of an SV, and sets *lp to its length. If flags
includes SV_GMAGIC, does an mg_get() first. Coerces sv to a string if necessary. Normally
invoked via the SvPV_flags macro. sv_2pv() and sv_2pv_nomg
usually end up here too.
char* sv_2pv_flags(SV* sv, STRLEN* lp, I32 flags)
|
|
- sv_2pv_nolen
-
Like sv_2pv(), but doesn't return the length too. You should usually use
the macro wrapper SvPV_nolen(sv) instead. char* sv_2pv_nolen(SV* sv)
- sv_2uv
-
Return the unsigned integer value of an SV, doing any necessary string conversion,
magic etc. Normally used via the SvUV(sv) and SvUVx(sv) macros.
- sv_backoff
-
Remove any string offset. You should normally use the SvOOK_off macro
wrapper instead.
- sv_bless
-
Blesses an SV into a specified package. The SV must be an RV. The package must be
designated by its stash (see gv_stashpv()). The reference count of the SV is
unaffected.
SV* sv_bless(SV* sv, HV* stash)
|
|
- sv_catpv
-
Concatenates the string onto the end of the string which is in the SV. If the SV has
the UTF8 status set, then the bytes appended should be valid UTF8. Handles 'get' magic,
but not 'set' magic. See sv_catpv_mg.
void sv_catpv(SV* sv, const char* ptr)
|
|
- sv_catpvf
-
Processes its arguments like 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. SvSETMAGIC() must typically be called after calling this function to
handle 'set' magic.
void sv_catpvf(SV* sv, const char* pat, ...)
|
|
- sv_catpvf_mg
-
Like sv_catpvf, but also handles 'set' magic.
void sv_catpvf_mg(SV *sv, const char* pat, ...)
|
|
- sv_catpvn
-
Concatenates the string onto the end of the string which is in the SV. The len
indicates number of bytes to copy. If the SV has the UTF8 status set, then the bytes
appended should be valid UTF8. Handles 'get' magic, but not 'set' magic. See sv_catpvn_mg.
void sv_catpvn(SV* sv, const char* ptr, STRLEN len)
|
|
- sv_catpvn_flags
-
Concatenates the string onto the end of the string which is in the SV. The len
indicates number of bytes to copy. If the SV has the UTF8 status set, then the bytes
appended should be valid UTF8. If flags has SV_GMAGIC bit set,
will mg_get on dsv if appropriate, else not. sv_catpvn
and sv_catpvn_nomg are implemented in terms of this function.
void sv_catpvn_flags(SV* sv, const char* ptr, STRLEN len, I32 flags)
|
|
- sv_catpvn_mg
-
Like sv_catpvn, but also handles 'set' magic.
void sv_catpvn_mg(SV *sv, const char *ptr, STRLEN len)
|
|
- sv_catpv_mg
-
Like sv_catpv, but also handles 'set' magic.
void sv_catpv_mg(SV *sv, const char *ptr)
|
|
- sv_catsv
-
Concatenates the string from SV ssv onto the end of the string in SV dsv.
Modifies dsv but not ssv. Handles 'get' magic, but not 'set'
magic. See sv_catsv_mg.
void sv_catsv(SV* dsv, SV* ssv)
|
|
- sv_catsv_flags
-
Concatenates the string from SV ssv onto the end of the string in SV dsv.
Modifies dsv but not ssv. If flags has SV_GMAGIC
bit set, will mg_get on the SVs if appropriate, else not. sv_catsv
and sv_catsv_nomg are implemented in terms of this function.
void sv_catsv_flags(SV* dsv, SV* ssv, I32 flags)
|
|
- sv_catsv_mg
-
Like sv_catsv, but also handles 'set' magic.
void sv_catsv_mg(SV *dstr, SV *sstr)
|
|
- sv_chop
-
Efficient removal of characters from the beginning of the string buffer. SvPOK(sv) must
be true and the ptr must be a pointer to somewhere inside the string buffer.
The ptr becomes the first character of the adjusted string. Uses the
"OOK hack".
void sv_chop(SV* sv, char* ptr)
|
|
- sv_clear
-
Clear an SV: call any destructors, free up any memory used by the body, and free the
body itself. The SV's head is not 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 REFCNT is zero. Most of the time you'll want to call sv_free()
(or its macro wrapper SvREFCNT_dec) instead.
- sv_cmp
-
Compares the strings in two SVs. Returns -1, 0, or 1 indicating whether the string in sv1
is less than, equal to, or greater than the string in sv2. Is UTF-8 and 'use
bytes' aware, handles get magic, and will coerce its args to strings if necessary. See
also sv_cmp_locale.
I32 sv_cmp(SV* sv1, SV* sv2)
|
|
- sv_cmp_locale
-
Compares the strings in two SVs in a locale-aware manner. Is UTF-8 and 'use bytes'
aware, handles get magic, and will coerce its args to strings if necessary. See also sv_cmp_locale.
See also sv_cmp.
I32 sv_cmp_locale(SV* sv1, SV* sv2)
|
|
- sv_collxfrm
-
Add Collate Transform magic to an SV if it doesn't already have it.
Any scalar variable may carry PERL_MAGIC_collxfrm 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.
char* sv_collxfrm(SV* sv, STRLEN* nxp)
|
|
- sv_copypv
-
Copies a stringified representation of the source SV into the destination SV.
Automatically performs any necessary mg_get and coercion of numeric values into strings.
Guaranteed to preserve UTF-8 flag even from overloaded objects. Similar in nature to
sv_2pv[_flags] but operates directly on an SV instead of just the string. Mostly uses
sv_2pv_flags to do its work, except when that would lose the UTF-8'ness of the PV.
void sv_copypv(SV* dsv, SV* ssv)
|
|
- sv_dec
-
Auto-decrement of the value in the SV, doing string to numeric conversion if necessary.
Handles 'get' magic.
- sv_derived_from
-
Returns a boolean indicating whether the SV is derived from the specified class. This
is the function that implements UNIVERSAL::isa. It works for class names as
well as for objects.
bool sv_derived_from(SV* sv, const char* name)
|
|
- sv_eq
-
Returns a boolean indicating whether the strings in the two SVs are identical. Is UTF-8
and 'use bytes' aware, handles get magic, and will coerce its args to strings if
necessary.
I32 sv_eq(SV* sv1, SV* sv2)
|
|
- sv_force_normal
-
Undo various types of fakery on an SV: if the PV is a shared string, make a private
copy; if we're a ref, stop refing; if we're a glob, downgrade to an xpvmg. See also sv_force_normal_flags.
void sv_force_normal(SV *sv)
|
|
- sv_force_normal_flags
-
Undo various types of fakery on an SV: if the PV is a shared string, make a private
copy; if we're a ref, stop refing; if we're a glob, downgrade to an xpvmg. The flags
parameter gets passed to sv_unref_flags() when unrefing. sv_force_normal
calls this function with flags set to 0.
void sv_force_normal_flags(SV *sv, U32 flags)
|
|
- sv_free
-
Decrement an SV's reference count, and if it drops to zero, call sv_clear
to invoke destructors and free up any memory used by the body; finally, deallocate the
SV's head itself. Normally called via a wrapper macro SvREFCNT_dec.
- sv_gets
-
Get a line from the filehandle and store it into the SV, optionally appending to the
currently-stored string.
char* sv_gets(SV* sv, PerlIO* fp, I32 append)
|
|
- sv_grow
-
Expands the character buffer in the SV. If necessary, uses sv_unref and
upgrades the SV to SVt_PV. Returns a pointer to the character buffer. Use the
SvGROW wrapper instead.
char* sv_grow(SV* sv, STRLEN newlen)
|
|
- sv_inc
-
Auto-increment of the value in the SV, doing string to numeric conversion if necessary.
Handles 'get' magic.
- sv_insert
-
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)
|
|
- sv_isa
-
Returns a boolean indicating whether the SV is blessed into the specified class. This
does not check for subtypes; use sv_derived_from to verify an inheritance
relationship.
int sv_isa(SV* sv, const char* name)
|
|
- sv_isobject
-
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.
- sv_iv
-
A private implementation of the SvIVx macro for compilers which can't cope
with complex macro expressions. Always use the macro instead.
- sv_len
-
Returns the length of the string in the SV. Handles magic and type coercion. See also SvCUR,
which gives raw access to the xpv_cur slot.
- sv_len_utf8
-
Returns the number of characters in the string in an SV, counting wide UTF8 bytes as a
single character. Handles magic and type coercion.
STRLEN sv_len_utf8(SV* sv)
|
|
- sv_magic
-
Adds magic to an SV. First upgrades sv to type SVt_PVMG if
necessary, then adds a new magic item of type how to the head of the magic
list.
void sv_magic(SV* sv, SV* obj, int how, const char* name, I32 namlen)
|
|
- sv_magicext
-
Adds magic to an SV, upgrading it if necessary. Applies the 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'
I namelen is greater then zero then a savepvn() copy of name
is stored, if namelen is zero then name is stored as-is and - as
another special case - if (name && namelen == HEf_SVKEY) then name
is assumed to contain an SV* and has its REFCNT incremented
(This is now used as a subroutine by sv_magic.)
MAGIC * sv_magicext(SV* sv, SV* obj, int how, MGVTBL *vtbl, const char* name, I32 namlen )
|
|
- sv_mortalcopy
-
Creates a new SV which is a copy of the original SV (using sv_setsv). The
new SV is marked as mortal. It will be destroyed "soon", either by an explicit
call to FREETMPS, or by an implicit call at places such as statement boundaries. See also sv_newmortal
and sv_2mortal.
SV* sv_mortalcopy(SV* oldsv)
|
|
- sv_newmortal
-
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 FREETMPS, or by an
implicit call at places such as statement boundaries. See also sv_mortalcopy
and sv_2mortal.
- sv_newref
-
Increment an SV's reference count. Use the SvREFCNT_inc() wrapper instead.
- sv_nolocking
-
Dummy routine which "locks" an SV when there is no locking module present.
Exists to avoid test for a NULL function pointer and because it could potentially warn
under some level of strict-ness.
- sv_nosharing
-
Dummy routine which "shares" an SV when there is no sharing module present.
Exists to avoid test for a NULL function pointer and because it could potentially warn
under some level of strict-ness.
- sv_nounlocking
-
Dummy routine which "unlocks" an SV when there is no locking module present.
Exists to avoid test for a NULL function pointer and because it could potentially warn
under some level of strict-ness.
void sv_nounlocking(SV *)
|
|
- sv_nv
-
A private implementation of the SvNVx macro for compilers which can't cope
with complex macro expressions. Always use the macro instead.
- sv_pos_b2u
-
Converts the value pointed to by offsetp from a count of bytes from the start of the
string, to a count of the equivalent number of UTF8 chars. Handles magic and type
coercion.
void sv_pos_b2u(SV* sv, I32* offsetp)
|
|
- sv_pos_u2b
-
Converts the value pointed to by offsetp from a count of UTF8 chars from the start of
the string, to a count of the equivalent number of bytes; if lenp is non-zero, it does the
same to lenp, but this time starting from the offset, rather than from the start of the
string. Handles magic and type coercion.
void sv_pos_u2b(SV* sv, I32* offsetp, I32* lenp)
|
|
- sv_pv
-
Use the SvPV_nolen macro instead
- sv_pvbyte
-
Use SvPVbyte_nolen instead.
- sv_pvbyten
-
A private implementation of the SvPVbyte macro for compilers which can't
cope with complex macro expressions. Always use the macro instead.
char* sv_pvbyten(SV *sv, STRLEN *len)
|
|
- sv_pvbyten_force
-
A private implementation of the SvPVbytex_force macro for compilers which
can't cope with complex macro expressions. Always use the macro instead.
char* sv_pvbyten_force(SV* sv, STRLEN* lp)
|
|
- sv_pvn
-
A private implementation of the SvPV macro for compilers which can't cope
with complex macro expressions. Always use the macro instead.
char* sv_pvn(SV *sv, STRLEN *len)
|
|
- sv_pvn_force
-
Get a sensible string out of the SV somehow. A private implementation of the SvPV_force
macro for compilers which can't cope with complex macro expressions. Always use the macro
instead.
char* sv_pvn_force(SV* sv, STRLEN* lp)
|
|
- sv_pvn_force_flags
-
Get a sensible string out of the SV somehow. If flags has SV_GMAGIC
bit set, will mg_get on sv if appropriate, else not. sv_pvn_force
and sv_pvn_force_nomg are implemented in terms of this function. You normally
want to use the various wrapper macros instead: see SvPV_force and SvPV_force_nomg
char* sv_pvn_force_flags(SV* sv, STRLEN* lp, I32 flags)
|
|
- sv_pvutf8
-
Use the SvPVutf8_nolen macro instead
- sv_pvutf8n
-
A private implementation of the SvPVutf8 macro for compilers which can't
cope with complex macro expressions. Always use the macro instead.
char* sv_pvutf8n(SV *sv, STRLEN *len)
|
|
- sv_pvutf8n_force
-
A private implementation of the SvPVutf8_force macro for compilers which
can't cope with complex macro expressions. Always use the macro instead.
char* sv_pvutf8n_force(SV* sv, STRLEN* lp)
|
|
- sv_reftype
-
Returns a string describing what the SV is a reference to.
char* sv_reftype(SV* sv, int ob)
|
|
- sv_replace
-
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 sv_setsv or one of its many macro front-ends.
void sv_replace(SV* sv, SV* nsv)
|
|
- sv_report_used
-
Dump the contents of all SVs not yet freed. (Debugging aid).
- sv_reset
-
Underlying implementation for the reset Perl function. Note that the
perl-level function is vaguely deprecated.
void sv_reset(char* s, HV* stash)
|
|
- sv_rvweaken
-
Weaken a reference: set the SvWEAKREF flag on this RV; give the
referred-to SV PERL_MAGIC_backref magic if it hasn't already; and push a
back-reference to this RV onto the array of backreferences associated with that magic.
- sv_setiv
-
Copies an integer into the given SV, upgrading first if necessary. Does not handle
'set' magic. See also sv_setiv_mg.
void sv_setiv(SV* sv, IV num)
|
|
- sv_setiv_mg
-
Like sv_setiv, but also handles 'set' magic.
void sv_setiv_mg(SV *sv, IV i)
|
|
- sv_setnv
-
Copies a double into the given SV, upgrading first if necessary. Does not handle 'set'
magic. See also sv_setnv_mg.
void sv_setnv(SV* sv, NV num)
|
|
- sv_setnv_mg
-
Like sv_setnv, but also handles 'set' magic.
void sv_setnv_mg(SV *sv, NV num)
|
|
- sv_setpv
-
Copies a string into an SV. The string must be null-terminated. Does not handle 'set'
magic. See sv_setpv_mg.
void sv_setpv(SV* sv, const char* ptr)
|
|
- sv_setpvf
-
Processes its arguments like sprintf and sets an SV to the formatted
output. Does not handle 'set' magic. See sv_setpvf_mg.
void sv_setpvf(SV* sv, const char* pat, ...)
|
|
- sv_setpvf_mg
-
Like sv_setpvf, but also handles 'set' magic.
void sv_setpvf_mg(SV *sv, const char* pat, ...)
|
|
- sv_setpvn
-
Copies a string into an SV. The len parameter indicates the number of
bytes to be copied. Does not handle 'set' magic. See sv_setpvn_mg.
void sv_setpvn(SV* sv, const char* ptr, STRLEN len)
|
|
- sv_setpvn_mg
-
Like sv_setpvn, but also handles 'set' magic.
void sv_setpvn_mg(SV *sv, const char *ptr, STRLEN len)
|
|
- sv_setpv_mg
-
Like sv_setpv, but also handles 'set' magic.
void sv_setpv_mg(SV *sv, const char *ptr)
|
|
- sv_setref_iv
-
Copies an integer into a new SV, optionally blessing the SV. The rv
argument will be upgraded to an RV. That RV will be modified to point to the new SV. The classname
argument indicates the package for the blessing. Set classname to Nullch
to avoid the blessing. The new SV will be returned and will have a reference count of 1.
SV* sv_setref_iv(SV* rv, const char* classname, IV iv)
|
|
- sv_setref_nv
-
Copies a double into a new SV, optionally blessing the SV. The rv argument
will be upgraded to an RV. That RV will be modified to point to the new SV. The classname
argument indicates the package for the blessing. Set classname to Nullch
to avoid the blessing. The new SV will be returned and will have a reference count of 1.
SV* sv_setref_nv(SV* rv, const char* classname, NV nv)
|
|
- sv_setref_pv
-
Copies a pointer into a new SV, optionally blessing the SV. The rv
argument will be upgraded to an RV. That RV will be modified to point to the new SV. If
the pv argument is NULL then PL_sv_undef will be placed into the
SV. The classname argument indicates the package for the blessing. Set classname
to Nullch to avoid the blessing. The new SV will be returned and will have a
reference count of 1.
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 sv_setref_pvn copies the string while this copies the pointer.
SV* sv_setref_pv(SV* rv, const char* classname, void* pv)
|
|
- sv_setref_pvn
-
Copies a string into a new SV, optionally blessing the SV. The length of the string
must be specified with n. The rv argument will be upgraded to an
RV. That RV will be modified to point to the new SV. The classname argument
indicates the package for the blessing. Set classname to Nullch
to avoid the blessing. The new SV will be returned and will have a reference count of 1.
Note that sv_setref_pv copies the pointer while this copies the string.
SV* sv_setref_pvn(SV* rv, const char* classname, char* pv, STRLEN n)
|
|
- sv_setref_uv
-
Copies an unsigned integer into a new SV, optionally blessing the SV. The rv
argument will be upgraded to an RV. That RV will be modified to point to the new SV. The classname
argument indicates the package for the blessing. Set classname to Nullch
to avoid the blessing. The new SV will be returned and will have a reference count of 1.
SV* sv_setref_uv(SV* rv, const char* classname, UV uv)
|
|
- sv_setsv
-
Copies the contents of the source SV ssv into the destination SV dsv.
The source SV may be destroyed if it is mortal, so don't use this 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.
You probably want to use one of the assortment of wrappers, such as SvSetSV,
SvSetSV_nosteal, SvSetMagicSV and SvSetMagicSV_nosteal.
void sv_setsv(SV* dsv, SV* ssv)
|
|
- sv_setsv_flags
-
Copies the contents of the source SV ssv into the destination SV dsv.
The source SV may be destroyed if it is mortal, so don't use this 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 flags
parameter has the SV_GMAGIC bit set, will mg_get on ssv
if appropriate, else not. sv_setsv and sv_setsv_nomg are
implemented in terms of this function.
You probably want to use one of the assortment of wrappers, such as SvSetSV,
SvSetSV_nosteal, SvSetMagicSV and SvSetMagicSV_nosteal.
This is the primary function for copying scalars, and most other copy-ish functions and
macros use this underneath.
void sv_setsv_flags(SV* dsv, SV* ssv, I32 flags)
|
|
- sv_setsv_mg
-
Like sv_setsv, but also handles 'set' magic.
void sv_setsv_mg(SV *dstr, SV *sstr)
|
|
- sv_setuv
-
Copies an unsigned integer into the given SV, upgrading first if necessary. Does not
handle 'set' magic. See also sv_setuv_mg.
void sv_setuv(SV* sv, UV num)
|
|
- sv_setuv_mg
-
Like sv_setuv, but also handles 'set' magic.
void sv_setuv_mg(SV *sv, UV u)
|
|
- sv_taint
-
Taint an SV. Use SvTAINTED_on instead. void sv_taint(SV* sv)
- sv_tainted
-
Test an SV for taintedness. Use SvTAINTED instead. bool sv_tainted(SV* sv)
- sv_true
-
Returns true if the SV has a true value by Perl's rules. Use the SvTRUE
macro instead, which may call sv_true() or may instead use an in-line
version.
- sv_unmagic
-
Removes all magic of type type from an SV.
int sv_unmagic(SV* sv, int type)
|
|
- sv_unref
-
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 newSVrv.
This is sv_unref_flags with the flag being zero. See SvROK_off.
- sv_unref_flags
-
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 newSVrv.
The cflags argument can contain SV_IMMEDIATE_UNREF 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 SvROK_off.
void sv_unref_flags(SV* sv, U32 flags)
|
|
- sv_untaint
-
Untaint an SV. Use SvTAINTED_off instead. void sv_untaint(SV* sv)
- sv_upgrade
-
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. You generally want to use
the SvUPGRADE macro wrapper. See also svtype.
bool sv_upgrade(SV* sv, U32 mt)
|
|
- sv_usepvn
-
Tells an SV to use ptr to find its string value. Normally the string is
stored inside the SV but sv_usepvn allows the SV to use an outside string. The ptr
should point to memory that was allocated by malloc. The string length, len,
must be supplied. This function will realloc the memory pointed to by ptr, so
that pointer should not be freed or used by the programmer after giving it to sv_usepvn.
Does not handle 'set' magic. See sv_usepvn_mg.
void sv_usepvn(SV* sv, char* ptr, STRLEN len)
|
|
- sv_usepvn_mg
-
Like sv_usepvn, but also handles 'set' magic.
void sv_usepvn_mg(SV *sv, char *ptr, STRLEN len)
|
|
- sv_utf8_decode
-
Convert the octets in the PV from UTF-8 to chars. Scan for validity and then turn off
SvUTF8 if needed so that we see characters. Used as a building block for decode_utf8 in
Encode.xs
NOTE: this function is experimental and may change or be removed without notice.
bool sv_utf8_decode(SV *sv)
|
|
- sv_utf8_downgrade
-
Attempt to convert the PV of an SV from UTF8-encoded to byte encoding. This may not be
possible if the PV contains non-byte encoding characters; if this is the case, either
returns false or, if fail_ok is not true, croaks.
This is not as a general purpose Unicode to byte encoding interface: use the Encode
extension for that.
NOTE: this function is experimental and may change or be removed without notice.
bool sv_utf8_downgrade(SV *sv, bool fail_ok)
|
|
- sv_utf8_encode
-
Convert the PV of an SV to UTF8-encoded, but then turn off the SvUTF8 flag
so that it looks like octets again. Used as a building block for encode_utf8 in Encode.xs
void sv_utf8_encode(SV *sv)
|
|
- sv_utf8_upgrade
-
Convert the PV of an SV to its UTF8-encoded form. Forces the SV to string form if it is
not already. Always sets the SvUTF8 flag to avoid future validity checks even if all the
bytes have hibit clear.
This is not as a general purpose byte encoding to Unicode interface: use the Encode
extension for that.
STRLEN sv_utf8_upgrade(SV *sv)
|
|
- sv_utf8_upgrade_flags
-
Convert the PV of an SV to its UTF8-encoded form. Forces the SV to string form if it is
not already. Always sets the SvUTF8 flag to avoid future validity checks even if all the
bytes have hibit clear. If flags has SV_GMAGIC bit set, will mg_get
on sv if appropriate, else not. sv_utf8_upgrade and sv_utf8_upgrade_nomg
are implemented in terms of this function.
This is not as a general purpose byte encoding to Unicode interface: use the Encode
extension for that.
STRLEN sv_utf8_upgrade_flags(SV *sv, I32 flags)
|
|
- sv_uv
-
A private implementation of the SvUVx macro for compilers which can't cope
with complex macro expressions. Always use the macro instead.
- sv_vcatpvfn
-
Processes its arguments like vsprintf and appends the formatted output to
an SV. Uses an array of SVs if the C style variable argument list is missing (NULL). When
running with taint checks enabled, indicates via maybe_tainted if results are
untrustworthy (often due to the use of locales).
Usually used via one of its frontends sv_catpvf and sv_catpvf_mg.
void sv_vcatpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
|
|
- sv_vsetpvfn
-
Works like vcatpvfn but copies the text into the SV instead of appending
it.
Usually used via one of its frontends sv_setpvf and sv_setpvf_mg.
void sv_vsetpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted)
|
|