X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/fd1423831cf9d78f9470d3a04e5c4e64f66173a6..28acfe03fc59abea4ef2451b134d560f411183ab:/sv.h diff --git a/sv.h b/sv.h index 4bfbf9c..0c1ded6 100644 --- a/sv.h +++ b/sv.h @@ -22,7 +22,6 @@ in the C enum. Test these flags with the C macro. The types are: SVt_NULL - SVt_BIND (unused) SVt_IV SVt_NV SVt_RV @@ -120,7 +119,7 @@ Type flag for I/O objects. See L. typedef enum { SVt_NULL, /* 0 */ - SVt_BIND, /* 1 */ + SVt_DUMMY, /* 1 */ SVt_IV, /* 2 */ SVt_NV, /* 3 */ /* RV was here, before it was merged with IV. */ @@ -463,10 +462,7 @@ union _xnvu { U32 xlow; U32 xhigh; } xpad_cop_seq; /* used by pad.c for cop_sequence */ - struct { - I32 xbm_useful; - U8 xbm_rare; /* rarest character in string */ - } xbm_s; /* fields from PVBM */ + I32 xbm_useful; }; union _xivu { @@ -532,7 +528,7 @@ struct xpvgv { union _xnvu xnv_u; }; -typedef U16 cv_flags_t; +typedef U32 cv_flags_t; #define _XPVCV_COMMON \ HV * xcv_stash; \ @@ -1361,32 +1357,23 @@ sv_force_normal does nothing. #endif #if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) -# define BmRARE(sv) \ - (*({ SV *const _bmrare = MUTABLE_SV(sv); \ - assert(SvTYPE(_bmrare) == SVt_PVMG); \ - assert(SvVALID(_bmrare)); \ - &(((XPVMG*) SvANY(_bmrare))->xnv_u.xbm_s.xbm_rare); \ - })) # define BmUSEFUL(sv) \ (*({ SV *const _bmuseful = MUTABLE_SV(sv); \ assert(SvTYPE(_bmuseful) == SVt_PVMG); \ assert(SvVALID(_bmuseful)); \ - assert(!SvIOK(_bmuseful)); \ - &(((XPVMG*) SvANY(_bmuseful))->xnv_u.xbm_s.xbm_useful); \ - })) -# define BmPREVIOUS(sv) \ - (*({ SV *const _bmprevious = MUTABLE_SV(sv); \ - assert(SvTYPE(_bmprevious) == SVt_PVMG); \ - assert(SvVALID(_bmprevious)); \ - &(((XPVMG*) SvANY(_bmprevious))->xiv_u.xivu_uv); \ + assert(!SvNOK(_bmuseful)); \ + &(((XPVMG*) SvANY(_bmuseful))->xnv_u.xbm_useful); \ })) #else -# define BmRARE(sv) ((XPVMG*) SvANY(sv))->xnv_u.xbm_s.xbm_rare -# define BmUSEFUL(sv) ((XPVMG*) SvANY(sv))->xnv_u.xbm_s.xbm_useful -# define BmPREVIOUS(sv) ((XPVMG*) SvANY(sv))->xiv_u.xivu_uv +# define BmUSEFUL(sv) ((XPVMG*) SvANY(sv))->xnv_u.xbm_useful #endif +#ifndef PERL_CORE +# define BmRARE(sv) 0 +# define BmPREVIOUS(sv) 0 +#endif + #define FmLINES(sv) ((XPVIV*) SvANY(sv))->xiv_iv #define LvTYPE(sv) ((XPVLV*) SvANY(sv))->xlv_type @@ -1490,11 +1477,13 @@ stringified version becoming C. Handles 'get' magic. See also C for a version which guarantees to evaluate sv only once. Note that there is no guarantee that the return value of C is -equal to C (or even that C contains valid data), 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 SvPVX field to be valid (for example, if you -intend to write to it), then see L. +equal to C, or that C contains valid data, or that +successive calls to C. =for apidoc Am|char*|SvPVx|SV* sv|STRLEN len A version of C which guarantees to evaluate C only once. @@ -1737,9 +1726,10 @@ Like sv_utf8_upgrade, but doesn't do magic on C. #define SvTRUE_common(sv,fallback) ( \ !SvOK(sv) \ ? 0 \ - : (SvFLAGS(sv) & (SVf_POK|SVf_IOK|SVf_NOK)) \ - ? ( (SvPOK(sv) && SvPVXtrue(sv)) \ - || (SvIOK(sv) && SvIVX(sv) != 0) \ + : SvPOK(sv) \ + ? SvPVXtrue(sv) \ + : (SvFLAGS(sv) & (SVf_IOK|SVf_NOK)) \ + ? ( (SvIOK(sv) && SvIVX(sv) != 0) \ || (SvNOK(sv) && SvNVX(sv) != 0.0)) \ : (fallback)) @@ -2217,6 +2207,54 @@ Evaluates I more than once. Sets I to 0 if C is false. #define newIO() MUTABLE_IO(newSV_type(SVt_PVIO)) +#define SV_CONST(name) \ + PL_sv_consts[SV_CONST_##name] \ + ? PL_sv_consts[SV_CONST_##name] \ + : (PL_sv_consts[SV_CONST_##name] = newSVpv_share(#name, 0)) + +#define SV_CONST_TIESCALAR 0 +#define SV_CONST_TIEARRAY 1 +#define SV_CONST_TIEHASH 2 +#define SV_CONST_TIEHANDLE 3 + +#define SV_CONST_FETCH 4 +#define SV_CONST_FETCHSIZE 5 +#define SV_CONST_STORE 6 +#define SV_CONST_STORESIZE 7 +#define SV_CONST_EXISTS 8 + +#define SV_CONST_PUSH 9 +#define SV_CONST_POP 10 +#define SV_CONST_SHIFT 11 +#define SV_CONST_UNSHIFT 12 +#define SV_CONST_SPLICE 13 +#define SV_CONST_EXTEND 14 + +#define SV_CONST_FIRSTKEY 15 +#define SV_CONST_NEXTKEY 16 +#define SV_CONST_SCALAR 17 + +#define SV_CONST_OPEN 18 +#define SV_CONST_WRITE 19 +#define SV_CONST_PRINT 20 +#define SV_CONST_PRINTF 21 +#define SV_CONST_READ 22 +#define SV_CONST_READLINE 23 +#define SV_CONST_GETC 24 +#define SV_CONST_SEEK 25 +#define SV_CONST_TELL 26 +#define SV_CONST_EOF 27 +#define SV_CONST_BINMODE 28 +#define SV_CONST_FILENO 29 +#define SV_CONST_CLOSE 30 + +#define SV_CONST_DELETE 31 +#define SV_CONST_CLEAR 32 +#define SV_CONST_UNTIE 33 +#define SV_CONST_DESTROY 34 + +#define SV_CONSTS_COUNT 35 + /* * Local variables: * c-indentation-style: bsd