X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=sv.h;h=ab04b0529a3fd8d643ab0434550781740d428c1c;hb=264cef28e9f800426234a9e31007e10cc2439aa3;hp=d9522c40f93fd6054477803c57ed8c384ff04b5d;hpb=9b2db8e94a2dd349aad72259cdcdd425bf501466;p=p5sagit%2Fp5-mst-13.2.git diff --git a/sv.h b/sv.h index d9522c4..ab04b05 100644 --- a/sv.h +++ b/sv.h @@ -1,6 +1,6 @@ /* sv.h * - * Copyright (c) 1991-2000, Larry Wall + * Copyright (c) 1991-2001, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -61,7 +61,7 @@ typedef enum { /* Using C's structural equivalence to help emulate C++ inheritance here... */ -struct sv { +struct STRUCT_SV { void* sv_any; /* pointer to something */ U32 sv_refcnt; /* how many references to us */ U32 sv_flags; /* what we are */ @@ -202,11 +202,7 @@ perform the upgrade if necessary. See C. #define SVp_POK 0x04000000 /* has valid non-public pointer value */ #define SVp_SCREAM 0x08000000 /* has been studied? */ -#ifdef EBCDIC -#define SVf_UTF8 0x00000000 /* SvPVX is not UTF-8 encoded */ -#else #define SVf_UTF8 0x20000000 /* SvPVX is UTF-8 encoded */ -#endif #define SVf_THINKFIRST (SVf_READONLY|SVf_ROK|SVf_FAKE|SVf_UTF8) @@ -452,6 +448,9 @@ Tells and SV that it is an unsigned integer and disables all other OK bits. =for apidoc Am|void|SvIOK_UV|SV* sv Returns a boolean indicating whether the SV contains an unsigned integer. +=for apidoc Am|void|SvUOK|SV* sv +Returns a boolean indicating whether the SV contains an unsigned integer. + =for apidoc Am|void|SvIOK_notUV|SV* sv Returns a boolean indicating whether the SV contains an signed integer. @@ -479,6 +478,7 @@ Unsets the PV status of an SV. =for apidoc Am|void|SvPOK_only|SV* sv Tells an SV that it is a string and disables all other OK bits. +Will also turn off the UTF8 status. =for apidoc Am|bool|SvOOK|SV* sv Returns a boolean indicating whether the SvIVX is a valid offset value for @@ -566,6 +566,7 @@ Set the length of the string which is in the SV. See C. #define SvIOK_UV(sv) ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) \ == (SVf_IOK|SVf_IVisUV)) +#define SvUOK(sv) SvIOK_UV(sv) #define SvIOK_notUV(sv) ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) \ == SVf_IOK) @@ -584,14 +585,15 @@ Set the length of the string which is in the SV. See C. Returns a boolean indicating whether the SV contains UTF-8 encoded data. =for apidoc Am|void|SvUTF8_on|SV *sv -Tells an SV that it is a string and encoded in UTF8. Do not use frivolously. +Turn on the UTF8 status of an SV (the data is not changed, just the flag). +Do not use frivolously. =for apidoc Am|void|SvUTF8_off|SV *sv Unsets the UTF8 status of an SV. =for apidoc Am|void|SvPOK_only_UTF8|SV* sv -Tells an SV that it is a UTF8 string (do not use frivolously) -and disables all other OK bits. +Tells an SV that it is a string and disables all other OK bits, +and leaves the UTF8 status as it was. =cut */ @@ -718,6 +720,12 @@ and disables all other OK bits. #define SvMAGIC(sv) ((XPVMG*) SvANY(sv))->xmg_magic #define SvSTASH(sv) ((XPVMG*) SvANY(sv))->xmg_stash +/* Ask a scalar nicely to try to become an IV, if possible. + Not guaranteed to stay returning void */ +/* Macro won't actually call sv_2iv if already IOK */ +#define SvIV_please(sv) \ + STMT_START {if (!SvIOKp(sv) && (SvNOK(sv) || SvPOK(sv))) \ + (void) SvIV(sv); } STMT_END #define SvIV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVIV*) SvANY(sv))->xiv_iv = val); } STMT_END @@ -805,7 +813,6 @@ Taints an SV if tainting is enabled #define SvTAINT(sv) \ STMT_START { \ if (PL_tainting) { \ - dTHR; \ if (PL_tainted) \ SvTAINTED_on(sv); \ } \ @@ -1101,3 +1108,8 @@ Returns a pointer to the character buffer. #define SvGROW(sv,len) (SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv)) #define Sv_Grow sv_grow +#define SV_IMMEDIATE_UNREF 1 + +#define CLONEf_COPY_STACKS 1 +#define CLONEf_KEEP_PTR_TABLE 2 +