diff options
author | Tony Cook <tony@develop-help.com> | 2015-12-17 15:27:46 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2015-12-17 15:27:46 +1100 |
commit | 364bbfa41090431b5fedf27a0b86684bb09ff167 (patch) | |
tree | f2b355700a301877ffce5ac0dda982a3beb2bd2e | |
parent | dc9ef9989ca4dc4207da49f653e8789816f50a11 (diff) | |
download | perl-364bbfa41090431b5fedf27a0b86684bb09ff167.tar.gz |
document save_gp() and the GVf_INTRO flag
-rw-r--r-- | embed.fnc | 2 | ||||
-rw-r--r-- | gv.h | 4 | ||||
-rw-r--r-- | scope.c | 13 |
3 files changed, 18 insertions, 1 deletions
@@ -1279,7 +1279,7 @@ Apmb |void |save_freepv |NULLOK char* pv Ap |void |save_generic_svref|NN SV** sptr Ap |void |save_generic_pvref|NN char** str Ap |void |save_shared_pvref|NN char** str -Ap |void |save_gp |NN GV* gv|I32 empty +Adp |void |save_gp |NN GV* gv|I32 empty Ap |HV* |save_hash |NN GV* gv Ap |void |save_hints Amp |void |save_helem |NN HV *hv|NN SV *key|NN SV **sptr @@ -151,6 +151,10 @@ Return the CV from the GV. #define GvENAME_HEK(gv) GvNAME_HEK(GvEGV(gv) ? GvEGV(gv) : gv) #define GvESTASH(gv) GvSTASH(GvEGV(gv) ? GvEGV(gv) : gv) +/* GVf_INTRO is one-shot flag which indicates that the next assignment + of a reference to the glob is to be localised; it distinguishes + 'local *g = $ref' from '*g = $ref'. +*/ #define GVf_INTRO 0x01 #define GVf_MULTI 0x02 #define GVf_ASSUMECV 0x04 @@ -298,6 +298,19 @@ Perl_save_set_svflags(pTHX_ SV* sv, U32 mask, U32 val) SS_ADD_END(4); } +/* +=for apidoc save_gp + +Saves the current GP of gv on the save stack to be restored on scope exit. + +If empty is true, replace the GP with a new GP. + +If empty is false, mark gv with GVf_INTRO so the next reference +assigned is localized, which is how C< local *foo = $someref; > works. + +=cut +*/ + void Perl_save_gp(pTHX_ GV *gv, I32 empty) { |