X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/4c60406d0e89efe615812945449c96f48bf70433..c80e42f3bedc86f49112644858de416b7d06c09a:/sv.h diff --git a/sv.h b/sv.h index 7110b4c..2f0eabc 100644 --- a/sv.h +++ b/sv.h @@ -120,8 +120,14 @@ Type flag for formats. See L. Type flag for I/O objects. See L. =cut + + These are ordered so that the simpler types have a lower value; SvUPGRADE + doesn't allow you to upgrade from a higher numbered type to a lower numbered + one; also there is code that assumes that anything that has as a PV component + has a type numbered >= SVt_PV. */ + typedef enum { SVt_NULL, /* 0 */ /* BIND was here, before INVLIST replaced it. */ @@ -154,7 +160,7 @@ typedef enum { #ifndef PERL_CORE /* Although Fast Boyer Moore tables are now being stored in PVGVs, for most - purposes eternal code wanting to consider PVBM probably needs to think of + purposes external code wanting to consider PVBM probably needs to think of PVMG instead. */ # define SVt_PVBM SVt_PVMG /* Anything wanting to create a reference from clean should ensure that it has @@ -354,8 +360,10 @@ perform the upgrade if necessary. See C. subroutine in another package. Set the GvIMPORTED_CV_on() if it needs to be expanded to a real GV */ +#define SVpad_NAMELIST SVp_SCREAM /* AV is a padnamelist */ #define SVf_IsCOW 0x00010000 /* copy on write (shared hash key if SvLEN == 0) */ + /* Also used on HVs in gv.c:gv_check */ #define SVs_PADTMP 0x00020000 /* in use as tmp; only if ! SVs_PADMY */ #define SVs_PADSTALE 0x00020000 /* lexical has gone out of scope; only valid for SVs_PADMY */ @@ -483,7 +491,7 @@ union _xmgu { MAGIC* xmg_magic; /* linked list of magicalness */ HV* xmg_ourstash; /* Stash for our (when SvPAD_OUR is true) */ STRLEN xmg_hash_index; /* used while freeing hash entries */ -}; +}; /* also used by PadnamelistMAXNAMED */ struct xpv { _XPV_HEAD; @@ -520,7 +528,10 @@ struct xpvlv { _XPV_HEAD; union _xivu xiv_u; union _xnvu xnv_u; - STRLEN xlv_targoff; + union { + STRLEN xlvu_targoff; + SSize_t xlvu_stargoff; + } xlv_targoff_u; STRLEN xlv_targlen; SV* xlv_targ; char xlv_type; /* k=keys .=pos x=substr v=vec /=join/re @@ -528,6 +539,8 @@ struct xpvlv { char xlv_flags; /* 1 = negative offset 2 = negative len */ }; +#define xlv_targoff xlv_targoff_u.xlvu_targoff + struct xpvinvlist { _XPV_HEAD; IV prev_index; @@ -943,6 +956,7 @@ in gv.h: */ #define HvAMAGIC_off(hv) (SvFLAGS(hv) &=~ SVf_AMAGIC) +/* "nog" means "doesn't have get magic" */ #define SvPOK_nog(sv) ((SvFLAGS(sv) & (SVf_POK|SVs_GMG)) == SVf_POK) #define SvIOK_nog(sv) ((SvFLAGS(sv) & (SVf_IOK|SVs_GMG)) == SVf_IOK) #define SvUOK_nog(sv) ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV|SVs_GMG)) == (SVf_IOK|SVf_IVisUV)) @@ -1394,6 +1408,7 @@ sv_force_normal does nothing. #define LvTYPE(sv) ((XPVLV*) SvANY(sv))->xlv_type #define LvTARG(sv) ((XPVLV*) SvANY(sv))->xlv_targ #define LvTARGOFF(sv) ((XPVLV*) SvANY(sv))->xlv_targoff +#define LvSTARGOFF(sv) ((XPVLV*) SvANY(sv))->xlv_targoff_u.xlvu_stargoff #define LvTARGLEN(sv) ((XPVLV*) SvANY(sv))->xlv_targlen #define LvFLAGS(sv) ((XPVLV*) SvANY(sv))->xlv_flags @@ -1961,12 +1976,11 @@ mg.c:1024: warning: left-hand operand of comma expression has no effect #define sv_catpvn_nomg_maybeutf8(dsv, sstr, slen, is_utf8) \ sv_catpvn_flags(dsv, sstr, slen, (is_utf8)?SV_CATUTF8:SV_CATBYTES) -#ifdef PERL_CORE +#if defined(PERL_CORE) || defined(PERL_EXT) # define sv_or_pv_len_utf8(sv, pv, bytelen) \ (SvGAMAGIC(sv) \ ? utf8_length((U8 *)(pv), (U8 *)(pv)+(bytelen)) \ : sv_len_utf8(sv)) -# define sv_or_pv_pos_u2b(sv,s,p,lp) S_sv_or_pv_pos_u2b(aTHX_ sv,s,p,lp) #endif /*