X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/73b81b142731b84cfdd5037cbef3bf9cf5ff3094..0727928ebd4d5aa9e77d5109e10966af77339480:/pad.h?ds=sidebyside diff --git a/pad.h b/pad.h index 7d05edc..184b067 100644 --- a/pad.h +++ b/pad.h @@ -10,7 +10,9 @@ * variables, op targets and constants. */ - +/* +=head1 Pad Data Structures +*/ /* a padlist is currently just an AV; but that might change, @@ -31,6 +33,12 @@ typedef U64TYPE PADOFFSET; #endif #define NOT_IN_PAD ((PADOFFSET) -1) +/* a value that PL_cop_seqmax is guaranteed never to be, + * flagging that a lexical is being introduced, or has not yet left scope + */ +#define PERL_PADSEQ_INTRO U32_MAX + + /* B.xs needs these for the benefit of B::Deparse */ /* Low range end is exclusive (valid from the cop seq after this one) */ /* High range end is inclusive (valid up to this cop seq) */ @@ -112,15 +120,12 @@ typedef enum { padtidy_FORMAT /* or a format */ } padtidy_type; -#ifdef PERL_CORE +/* flags for pad_add_name_pvn. */ -/* flags for pad_add_name. SVf_UTF8 will also be valid in the future. */ - -# define pad_add_OUR 0x01 /* our declaration. */ -# define pad_add_STATE 0x02 /* state declaration. */ -# define pad_add_NO_DUP_CHECK 0x04 /* skip warning on dups. */ - -#endif +#define padadd_OUR 0x01 /* our declaration. */ +#define padadd_STATE 0x02 /* state declaration. */ +#define padadd_NO_DUP_CHECK 0x04 /* skip warning on dups. */ +#define padadd_UTF8_NAME SVf_UTF8 /* name is UTF-8 encoded. */ /* ASSERT_CURPAD_LEGAL and ASSERT_CURPAD_ACTIVE respectively determine * whether PL_comppad and PL_curpad are consistent and whether they have @@ -249,7 +254,8 @@ Restore the old pad saved into the local variable opad by PAD_SAVE_LOCAL() PTR2UV(PL_comppad), PTR2UV(PL_curpad))); #define PAD_RESTORE_LOCAL(opad) \ - PL_comppad = opad && SvIS_FREED(opad) ? NULL : opad; \ + assert(!opad || !SvIS_FREED(opad)); \ + PL_comppad = opad; \ PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \ DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ "Pad 0x%"UVxf"[0x%"UVxf"] restore_local\n", \ @@ -302,8 +308,7 @@ ling pad (lvalue) to C. Note that C is hijacked for this purpose #define PAD_COMPNAME_SV(po) (*av_fetch(PL_comppad_name, (po), FALSE)) #define PAD_COMPNAME_FLAGS(po) SvFLAGS(PAD_COMPNAME_SV(po)) -#define PAD_COMPNAME_FLAGS_isOUR(po) \ - ((PAD_COMPNAME_FLAGS(po) & (SVpad_NAME|SVpad_OUR)) == (SVpad_NAME|SVpad_OUR)) +#define PAD_COMPNAME_FLAGS_isOUR(po) SvPAD_OUR(PAD_COMPNAME_SV(po)) #define PAD_COMPNAME_PV(po) SvPV_nolen(PAD_COMPNAME_SV(po)) #define PAD_COMPNAME_TYPE(po) pad_compname_type(po) @@ -360,6 +365,30 @@ Clone the state variables associated with running and compiling pads. PL_cop_seqmax = proto_perl->Icop_seqmax; /* +=for apidoc Am|PADOFFSET|pad_add_name_pvs|const char *name|U32 flags|HV *typestash|HV *ourstash + +Exactly like L, but takes a literal string instead +of a string/length pair. + +=cut +*/ + +#define pad_add_name_pvs(name,flags,typestash,ourstash) \ + Perl_pad_add_name_pvn(aTHX_ STR_WITH_LEN(name), flags, typestash, ourstash) + +/* +=for apidoc Am|PADOFFSET|pad_findmy_pvs|const char *name|U32 flags + +Exactly like L, but takes a literal string instead +of a string/length pair. + +=cut +*/ + +#define pad_findmy_pvs(name,flags) \ + Perl_pad_findmy_pvn(aTHX_ STR_WITH_LEN(name), flags) + +/* * Local variables: * c-indentation-style: bsd * c-basic-offset: 4