📄 perlintern.1
字号:
Set the current pad to be pad \f(CW\*(C`n\*(C'\fR in the padlist, savingthe previous current pad. \s-1NB\s0 currently this macro expands to a string toolong for some compilers, so it's best to replace it with.Sp.Vb 2\& SAVECOMPPAD();\& PAD_SET_CUR_NOSAVE(padlist,n);\&\&\& void PAD_SET_CUR(PADLIST padlist, I32 n).Ve.IP "\s-1PAD_SET_CUR_NOSAVE\s0" 8.IX Xref "PAD_SET_CUR_NOSAVE".IX Item "PAD_SET_CUR_NOSAVE"like \s-1PAD_SET_CUR\s0, but without the save.Sp.Vb 1\& void PAD_SET_CUR_NOSAVE(PADLIST padlist, I32 n).Ve.IP "\s-1PAD_SV\s0" 8.IX Xref "PAD_SV".IX Item "PAD_SV"Get the value at offset \f(CW\*(C`po\*(C'\fR in the current pad.Sp.Vb 1\& void PAD_SV(PADOFFSET po).Ve.IP "PAD_SVl" 8.IX Xref "PAD_SVl".IX Item "PAD_SVl"Lightweight and lvalue version of \f(CW\*(C`PAD_SV\*(C'\fR.Get or set the value at offset \f(CW\*(C`po\*(C'\fR in the current pad.Unlike \f(CW\*(C`PAD_SV\*(C'\fR, does not print diagnostics with \-DX.For internal use only..Sp.Vb 1\& SV * PAD_SVl(PADOFFSET po).Ve.IP "\s-1SAVECLEARSV\s0" 8.IX Xref "SAVECLEARSV".IX Item "SAVECLEARSV"Clear the pointed to pad value on scope exit. (i.e. the runtime action of 'my').Sp.Vb 1\& void SAVECLEARSV(SV **svp).Ve.IP "\s-1SAVECOMPPAD\s0" 8.IX Xref "SAVECOMPPAD".IX Item "SAVECOMPPAD"save PL_comppad and PL_curpad.Sp.Vb 1\& void SAVECOMPPAD().Ve.IP "\s-1SAVEPADSV\s0" 8.IX Xref "SAVEPADSV".IX Item "SAVEPADSV"Save a pad slot (used to restore after an iteration).Sp\&\s-1XXX\s0 \s-1DAPM\s0 it would make more sense to make the arg a \s-1PADOFFSET\s0 void \s-1SAVEPADSV\s0(\s-1PADOFFSET\s0 po).SH "GV Functions".IX Header "GV Functions".IP "is_gv_magical" 8.IX Xref "is_gv_magical".IX Item "is_gv_magical"Returns \f(CW\*(C`TRUE\*(C'\fR if given the name of a magical \s-1GV\s0..SpCurrently only useful internally when determining if a \s-1GV\s0 should becreated even in rvalue contexts..Sp\&\f(CW\*(C`flags\*(C'\fR is not used at present but available for future extension toallow selecting particular classes of magical variable..SpCurrently assumes that \f(CW\*(C`name\*(C'\fR is \s-1NUL\s0 terminated (as well as len being valid).This assumption is met by all callers within the perl core, which all passpointers returned by SvPV..Sp.Vb 1\& bool is_gv_magical(const char *name, STRLEN len, U32 flags).Ve.IP "is_gv_magical_sv" 8.IX Xref "is_gv_magical_sv".IX Item "is_gv_magical_sv"Returns \f(CW\*(C`TRUE\*(C'\fR if given the name of a magical \s-1GV\s0. Calls is_gv_magical..Sp.Vb 1\& bool is_gv_magical_sv(SV *name, U32 flags).Ve.SH "Hash Manipulation Functions".IX Header "Hash Manipulation Functions".IP "refcounted_he_chain_2hv" 8.IX Xref "refcounted_he_chain_2hv".IX Item "refcounted_he_chain_2hv"Generates and returns a \f(CW\*(C`HV *\*(C'\fR by walking up the tree starting at the passedin \f(CW\*(C`struct refcounted_he *\*(C'\fR..Sp.Vb 1\& HV * refcounted_he_chain_2hv(const struct refcounted_he *c).Ve.IP "refcounted_he_free" 8.IX Xref "refcounted_he_free".IX Item "refcounted_he_free"Decrements the reference count of the passed in \f(CW\*(C`struct refcounted_he *\*(C'\fRby one. If the reference count reaches zero the structure's memory is freed,and \f(CW\*(C`refcounted_he_free\*(C'\fR iterates onto the parent node..Sp.Vb 1\& void refcounted_he_free(struct refcounted_he *he).Ve.IP "refcounted_he_new" 8.IX Xref "refcounted_he_new".IX Item "refcounted_he_new"Creates a new \f(CW\*(C`struct refcounted_he\*(C'\fR. As key is copied, and value isstored in a compact form, all references remain the property of the caller.The \f(CW\*(C`struct refcounted_he\*(C'\fR is returned with a reference count of 1..Sp.Vb 1\& struct refcounted_he * refcounted_he_new(struct refcounted_he *const parent, SV *const key, SV *const value).Ve.SH "IO Functions".IX Header "IO Functions".IP "start_glob" 8.IX Xref "start_glob".IX Item "start_glob"Function called by \f(CW\*(C`do_readline\*(C'\fR to spawn a glob (or do the glob insideperl on \s-1VMS\s0). This code used to be inline, but now perl uses \f(CW\*(C`File::Glob\*(C'\fRthis glob starter is only used by miniperl during the build process.Moving it away shrinks pp_hot.c; shrinking pp_hot.c helps speed perl up..Sp.Vb 1\& PerlIO* start_glob(SV* pattern, IO *io).Ve.SH "Magical Functions".IX Header "Magical Functions".IP "magic_sethint" 8.IX Xref "magic_sethint".IX Item "magic_sethint"Triggered by a delete from %^H, records the key to\&\f(CW\*(C`PL_compiling.cop_hints_hash\*(C'\fR..Sp.Vb 1\& int magic_sethint(SV* sv, MAGIC* mg).Ve.IP "mg_localize" 8.IX Xref "mg_localize".IX Item "mg_localize"Copy some of the magic from an existing \s-1SV\s0 to new localized version ofthat \s-1SV\s0. Container magic (eg \f(CW%ENV\fR, \f(CW$1\fR, tie) gets copied, value magicdoesn't (eg taint, pos)..Sp.Vb 1\& void mg_localize(SV* sv, SV* nsv).Ve.SH "MRO Functions".IX Header "MRO Functions".IP "mro_get_linear_isa_c3" 8.IX Xref "mro_get_linear_isa_c3".IX Item "mro_get_linear_isa_c3"Returns the C3 linearization of \f(CW@ISA\fRthe given stash. The return value is a read-only AV*.\&\f(CW\*(C`level\*(C'\fR should be 0 (it is used internally in thisfunction's recursion)..SpYou are responsible for \f(CW\*(C`SvREFCNT_inc()\*(C'\fR on thereturn value if you plan to store it anywheresemi-permanently (otherwise it might be deletedout from under you the next time the cache isinvalidated)..Sp.Vb 1\& AV* mro_get_linear_isa_c3(HV* stash, I32 level).Ve.IP "mro_get_linear_isa_dfs" 8.IX Xref "mro_get_linear_isa_dfs".IX Item "mro_get_linear_isa_dfs"Returns the Depth-First Search linearization of \f(CW@ISA\fRthe given stash. The return value is a read-only AV*.\&\f(CW\*(C`level\*(C'\fR should be 0 (it is used internally in thisfunction's recursion)..SpYou are responsible for \f(CW\*(C`SvREFCNT_inc()\*(C'\fR on thereturn value if you plan to store it anywheresemi-permanently (otherwise it might be deletedout from under you the next time the cache isinvalidated)..Sp.Vb 1\& AV* mro_get_linear_isa_dfs(HV* stash, I32 level).Ve.IP "mro_isa_changed_in" 8.IX Xref "mro_isa_changed_in".IX Item "mro_isa_changed_in"Takes the necessary steps (cache invalidations, mostly)when the \f(CW@ISA\fR of the given package has changed. Invokedby the \f(CW\*(C`setisa\*(C'\fR magic, should not need to invoke directly..Sp.Vb 1\& void mro_isa_changed_in(HV* stash).Ve.SH "Pad Data Structures".IX Header "Pad Data Structures".IP "CvPADLIST" 8.IX Xref "CvPADLIST".IX Item "CvPADLIST"\&\s-1CV\s0's can have CvPADLIST(cv) set to point to an \s-1AV\s0..SpFor these purposes \*(L"forms\*(R" are a kind-of \s-1CV\s0, eval"\*(L"s are too (except they'renot callable at will and are always thrown away after the eval\*(R"" is doneexecuting). Require'd files are simply evals without any outer lexicalscope..SpXSUBs don't have CvPADLIST set \- dXSTARG fetches values from PL_curpad,but that is really the callers pad (a slot of which is allocated byevery entersub)..SpThe CvPADLIST \s-1AV\s0 has does not have AvREAL set, so \s-1REFCNT\s0 of component itemsis managed \*(L"manual\*(R" (mostly in pad.c) rather than normal av.c rules.The items in the \s-1AV\s0 are not SVs as for a normal \s-1AV\s0, but other AVs:.Sp0'th Entry of the CvPADLIST is an \s-1AV\s0 which represents the \*(L"names\*(R" or ratherthe \*(L"static type information\*(R" for lexicals..SpThe CvDEPTH'th entry of CvPADLIST \s-1AV\s0 is an \s-1AV\s0 which is the stack frame at thatdepth of recursion into the \s-1CV\s0.The 0'th slot of a frame \s-1AV\s0 is an \s-1AV\s0 which is \f(CW@_\fR.other entries are storage for variables and op targets..SpDuring compilation:\&\f(CW\*(C`PL_comppad_name\*(C'\fR is set to the names \s-1AV\s0.\&\f(CW\*(C`PL_comppad\*(C'\fR is set to the frame \s-1AV\s0 for the frame CvDEPTH == 1.\&\f(CW\*(C`PL_curpad\*(C'\fR is set to the body of the frame \s-1AV\s0 (i.e. AvARRAY(PL_comppad))..SpDuring execution, \f(CW\*(C`PL_comppad\*(C'\fR and \f(CW\*(C`PL_curpad\*(C'\fR refer to the liveframe of the currently executing sub..SpIterating over the names \s-1AV\s0 iterates over all possible paditems. Pad slots that are SVs_PADTMP (targets/GVs/constants) end up having&PL_sv_undef \*(L"names\*(R" (see \fIpad_alloc()\fR)..SpOnly my/our variable (SVs_PADMY/SVs_PADOUR) slots get valid names.The rest are op targets/GVs/constants which are statically allocatedor resolved at compile time. These don't have names by which theycan be looked up from Perl code at run time through eval"\*(L" likemy/our variables can be. Since they can't be looked up by \*(R"name"but only by their index allocated at compile time (which is usuallyin PL_op\->op_targ), wasting a name \s-1SV\s0 for them doesn't make sense..SpThe SVs in the names \s-1AV\s0 have their \s-1PV\s0 being the name of the variable.xlow+1..xhigh inclusive in the \s-1NV\s0 union is a range of cop_seq numbers forwhich the name is valid. For typed lexicals name \s-1SV\s0 is SVt_PVMG and SvSTASHpoints at the type. For \f(CW\*(C`our\*(C'\fR lexicals, the type is also SVt_PVMG, with theSvOURSTASH slot pointing at the stash of the associated global (so thatduplicate \f(CW\*(C`our\*(C'\fR declarations in the same package can be detected). SvUVX issometimes hijacked to store the generation number during compilation..SpIf SvFAKE is set on the name \s-1SV\s0, then that slot in the frame \s-1AV\s0 isa \s-1REFCNT\s0'ed reference to a lexical from \*(L"outside\*(R". In this case,the name \s-1SV\s0 does not use xlow and xhigh to store a cop_seq range, since it isin scope throughout. Instead xhigh stores some flags containing info aboutthe real lexical (is it declared in an anon, and is it capable of beinginstantiated multiple times?), and for fake ANONs, xlow contains the indexwithin the parent's pad where the lexical's value is stored, to makecloning quicker..SpIf the 'name' is '&' the corresponding entry in frame \s-1AV\s0is a \s-1CV\s0 representing a possible closure.(SvFAKE and name of '&' is not a meaningful combination currently but couldbecome so if \f(CW\*(C`my sub foo {}\*(C'\fR is implemented.).SpNote that formats are treated as anon subs, and are cloned each timewrite is called (if necessary)..SpThe flag SVf_PADSTALE is cleared on lexicals each time the \fImy()\fR is executed,and set on scope exit. This allows the 'Variable \f(CW$x\fR is not available' warningto be generated in evals, such as.Sp.Vb 1\& { my $x = 1; sub f { eval \*(Aq$x\*(Aq} } f();\&\& AV * CvPADLIST(CV *cv).Ve.IP "cv_clone" 8.IX Xref "cv_clone".IX Item "cv_clone"Clone a \s-1CV:\s0 make a new \s-1CV\s0 which points to the same code etc, but whichhas a newly-created pad built by copying the prototype pad and capturingany outer lexicals..Sp.Vb 1\& CV* cv_clone(CV* proto).Ve.IP "cv_dump" 8.IX Xref "cv_dump".IX Item "cv_dump"dump the contents of a \s-1CV\s0.Sp.Vb 1\& void cv_dump(const CV *cv, const char *title).Ve.IP "do_dump_pad" 8.IX Xref "do_dump_pad".IX Item "do_dump_pad"Dump the contents of a padlist.Sp.Vb 1\& void do_dump_pad(I32 level, PerlIO *file, PADLIST *padlist, int full).Ve.IP "intro_my" 8.IX Xref "intro_my".IX Item "intro_my"\&\*(L"Introduce\*(R" my variables to visible status..Sp.Vb 1\& U32 intro_my().Ve.IP "pad_add_anon" 8.IX Xref "pad_add_anon".IX Item "pad_add_anon"Add an anon code entry to the current compiling pad.Sp.Vb 1\& PADOFFSET pad_add_anon(SV* sv, OPCODE op_type).Ve.IP "pad_add_name" 8.IX Xref "pad_add_name".IX Item "pad_add_name"Create a new name and associated \s-1PADMY\s0 \s-1SV\s0 in the current pad; return theoffset.If \f(CW\*(C`typestash\*(C'\fR is valid, the name is for a typed lexical; set thename's stash to that value.If \f(CW\*(C`ourstash\*(C'\fR is valid, it's an our lexical, set the name'sSvOURSTASH to that value.SpIf fake, it means we're cloning an existing entry.Sp.Vb 1\& PADOFFSET pad_add_name(const char *name, HV* typestash, HV* ourstash, bool clone, bool state).Ve.IP "pad_alloc" 8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -