X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/3f774658ecc4b04691265c9db31d70a4a611b290..2aefcc789e83c2ed63b8e10639b28c870b3f9bf6:/pad.h diff --git a/pad.h b/pad.h index 54e8bc1..b331cea 100644 --- a/pad.h +++ b/pad.h @@ -1,6 +1,6 @@ /* pad.h * - * Copyright (c) 2002, Larry Wall + * Copyright (C) 2002, by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -105,6 +105,9 @@ Get the value from slot C in the base (DEPTH=1) pad of a padlist Set the current pad to be pad C in the padlist, saving the previous current pad. +=for apidoc m|void|PAD_SET_CUR_NOSAVE |PADLIST padlist|I32 n +like PAD_SET_CUR, but without the save + =for apidoc m|void|PAD_SAVE_SETNULLPAD Save the current pad then set it to null. @@ -133,8 +136,7 @@ Restore the old pad saved into the local variable opad by PAD_SAVE_LOCAL() ? AvARRAY((AV*)(AvARRAY(padlist)[1]))[po] : Nullsv; -#define PAD_SET_CUR(padlist,n) \ - SAVECOMPPAD(); \ +#define PAD_SET_CUR_NOSAVE(padlist,n) \ PL_comppad = (PAD*) (AvARRAY(padlist)[n]); \ PL_curpad = AvARRAY(PL_comppad); \ DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ @@ -142,6 +144,11 @@ Restore the old pad saved into the local variable opad by PAD_SAVE_LOCAL() PTR2UV(PL_comppad), PTR2UV(PL_curpad), (int)(n))); +#define PAD_SET_CUR(padlist,n) \ + SAVECOMPPAD(); \ + PAD_SET_CUR_NOSAVE(padlist,n); + + #define PAD_SAVE_SETNULLPAD() SAVECOMPPAD(); \ PL_comppad = Null(PAD*); PL_curpad = Null(SV**); \ DEBUG_Xv(PerlIO_printf(Perl_debug_log, "Pad set_null\n")); @@ -198,23 +205,25 @@ Assumes the slot entry is a valid C lexical. The generation number of the name at offset C in the current compiling pad (lvalue). Note that C is hijacked for this purpose. +=for apidoc m|STRLEN|PAD_COMPNAME_GEN_set|PADOFFSET po|int gen +Sets the generation number of the name at offset C in the current +ling pad (lvalue) to C. Note that C is hijacked for this purpose. + =cut + */ #define PAD_COMPNAME_FLAGS(po) SvFLAGS(*av_fetch(PL_comppad_name, (po), FALSE)) #define PAD_COMPNAME_PV(po) SvPV_nolen(*av_fetch(PL_comppad_name, (po), FALSE)) -/* XXX DAPM yuk - using av_fetch twice. Is there a better way? */ -#define PAD_COMPNAME_TYPE(po) \ - ((SvFLAGS(*av_fetch(PL_comppad_name, (po), FALSE)) & SVpad_TYPED) \ - ? (SvSTASH(*av_fetch(PL_comppad_name, (po), FALSE))) : Nullhv) +#define PAD_COMPNAME_TYPE(po) pad_compname_type(po) #define PAD_COMPNAME_OURSTASH(po) \ (GvSTASH(*av_fetch(PL_comppad_name, (po), FALSE))) #define PAD_COMPNAME_GEN(po) SvCUR(AvARRAY(PL_comppad_name)[po]) - +#define PAD_COMPNAME_GEN_set(po, gen) SvCUR_set(AvARRAY(PL_comppad_name)[po], gen) /* @@ -249,7 +258,7 @@ Clone the state variables associated with running and compiling pads. * sub's CV or padlist. */ #define PAD_CLONE_VARS(proto_perl, param) \ - PL_comppad = ptr_table_fetch(PL_ptr_table, proto_perl->Icomppad); \ + PL_comppad = (AV *) ptr_table_fetch(PL_ptr_table, proto_perl->Icomppad); \ PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : Null(SV**); \ PL_comppad_name = av_dup(proto_perl->Icomppad_name, param); \ PL_comppad_name_fill = proto_perl->Icomppad_name_fill; \