📄 pp.h
字号:
/* pp.h * * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, * 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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. * */#define PP(s) OP * Perl_##s(pTHX)/*=head1 Stack Manipulation Macros=for apidoc AmU||SPStack pointer. This is usually handled by C<xsubpp>. See C<dSP> andC<SPAGAIN>.=for apidoc AmU||MARKStack marker variable for the XSUB. See C<dMARK>.=for apidoc Am|void|PUSHMARK|SPOpening bracket for arguments on a callback. See C<PUTBACK> andL<perlcall>.=for apidoc Ams||dSPDeclares a local copy of perl's stack pointer for the XSUB, available viathe C<SP> macro. See C<SP>.=for apidoc ms||djSPDeclare Just C<SP>. This is actually identical to C<dSP>, and declaresa local copy of perl's stack pointer, available via the C<SP> macro.See C<SP>. (Available for backward source code compatibility with theold (Perl 5.005) thread model.)=for apidoc Ams||dMARKDeclare a stack marker variable, C<mark>, for the XSUB. See C<MARK> andC<dORIGMARK>.=for apidoc Ams||dORIGMARKSaves the original stack mark for the XSUB. See C<ORIGMARK>.=for apidoc AmU||ORIGMARKThe original stack mark for the XSUB. See C<dORIGMARK>.=for apidoc Ams||SPAGAINRefetch the stack pointer. Used after a callback. See L<perlcall>.=cut */#undef SP /* Solaris 2.7 i386 has this in /usr/include/sys/reg.h */#define SP sp#define MARK mark#define TARG targ#define PUSHMARK(p) \ STMT_START { \ if (++PL_markstack_ptr == PL_markstack_max) \ markstack_grow(); \ *PL_markstack_ptr = (I32)((p) - PL_stack_base);\ } STMT_END#define TOPMARK (*PL_markstack_ptr)#define POPMARK (*PL_markstack_ptr--)#define dSP SV **sp = PL_stack_sp#define djSP dSP#define dMARK register SV **mark = PL_stack_base + POPMARK#define dORIGMARK const I32 origmark = (I32)(mark - PL_stack_base)#define ORIGMARK (PL_stack_base + origmark)#define SPAGAIN sp = PL_stack_sp#define MSPAGAIN STMT_START { sp = PL_stack_sp; mark = ORIGMARK; } STMT_END#define GETTARGETSTACKED targ = (PL_op->op_flags & OPf_STACKED ? POPs : PAD_SV(PL_op->op_targ))#define dTARGETSTACKED SV * GETTARGETSTACKED#define GETTARGET targ = PAD_SV(PL_op->op_targ)#define dTARGET SV * GETTARGET#define GETATARGET targ = (PL_op->op_flags & OPf_STACKED ? sp[-1] : PAD_SV(PL_op->op_targ))#define dATARGET SV * GETATARGET#define dTARG SV *targ#define NORMAL PL_op->op_next#define DIE return Perl_die/*=for apidoc Ams||PUTBACKClosing bracket for XSUB arguments. This is usually handled by C<xsubpp>.See C<PUSHMARK> and L<perlcall> for other uses.=for apidoc Amn|SV*|POPsPops an SV off the stack.=for apidoc Amn|char*|POPpPops a string off the stack. Deprecated. New code should use POPpx.=for apidoc Amn|char*|POPpxPops a string off the stack.=for apidoc Amn|char*|POPpbytexPops a string off the stack which must consist of bytes i.e. characters < 256.=for apidoc Amn|NV|POPnPops a double off the stack.=for apidoc Amn|IV|POPiPops an integer off the stack.=for apidoc Amn|long|POPlPops a long off the stack.=cut*/#define PUTBACK PL_stack_sp = sp#define RETURN return (PUTBACK, NORMAL)#define RETURNOP(o) return (PUTBACK, o)#define RETURNX(x) return (x, PUTBACK, NORMAL)#define POPs (*sp--)#define POPp (SvPVx(POPs, PL_na)) /* deprecated */#define POPpx (SvPVx_nolen(POPs))#define POPpconstx (SvPVx_nolen_const(POPs))#define POPpbytex (SvPVbytex_nolen(POPs))#define POPn (SvNVx(POPs))#define POPi ((IV)SvIVx(POPs))#define POPu ((UV)SvUVx(POPs))#define POPl ((long)SvIVx(POPs))#define POPul ((unsigned long)SvIVx(POPs))#ifdef HAS_QUAD#define POPq ((Quad_t)SvIVx(POPs))#define POPuq ((Uquad_t)SvUVx(POPs))#endif#define TOPs (*sp)#define TOPm1s (*(sp-1))#define TOPp1s (*(sp+1))#define TOPp (SvPV(TOPs, PL_na)) /* deprecated */#define TOPpx (SvPV_nolen(TOPs))#define TOPn (SvNV(TOPs))#define TOPi ((IV)SvIV(TOPs))#define TOPu ((UV)SvUV(TOPs))#define TOPl ((long)SvIV(TOPs))#define TOPul ((unsigned long)SvUV(TOPs))#ifdef HAS_QUAD#define TOPq ((Quad_t)SvIV(TOPs))#define TOPuq ((Uquad_t)SvUV(TOPs))#endif/* Go to some pains in the rare event that we must extend the stack. *//*=for apidoc Am|void|EXTEND|SP|int nitemsUsed to extend the argument stack for an XSUB's return values. Onceused, guarantees that there is room for at least C<nitems> to be pushedonto the stack.=for apidoc Am|void|PUSHs|SV* svPush an SV onto the stack. The stack must have room for this element.Does not handle 'set' magic. Does not use C<TARG>. See also C<PUSHmortal>,C<XPUSHs> and C<XPUSHmortal>.=for apidoc Am|void|PUSHp|char* str|STRLEN lenPush a string onto the stack. The stack must have room for this element.The C<len> indicates the length of the string. Handles 'set' magic. UsesC<TARG>, so C<dTARGET> or C<dXSTARG> should be called to declare it. Do notcall multiple C<TARG>-oriented macros to return lists from XSUB's - seeC<mPUSHp> instead. See also C<XPUSHp> and C<mXPUSHp>.=for apidoc Am|void|PUSHn|NV nvPush a double onto the stack. The stack must have room for this element.Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should becalled to declare it. Do not call multiple C<TARG>-oriented macros toreturn lists from XSUB's - see C<mPUSHn> instead. See also C<XPUSHn> andC<mXPUSHn>.=for apidoc Am|void|PUSHi|IV ivPush an integer onto the stack. The stack must have room for this element.Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should becalled to declare it. Do not call multiple C<TARG>-oriented macros to return lists from XSUB's - see C<mPUSHi> instead. See also C<XPUSHi> andC<mXPUSHi>.=for apidoc Am|void|PUSHu|UV uvPush an unsigned integer onto the stack. The stack must have room for thiselement. Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG>should be called to declare it. Do not call multiple C<TARG>-orientedmacros to return lists from XSUB's - see C<mPUSHu> instead. See alsoC<XPUSHu> and C<mXPUSHu>.=for apidoc Am|void|XPUSHs|SV* svPush an SV onto the stack, extending the stack if necessary. Does nothandle 'set' magic. Does not use C<TARG>. See also C<XPUSHmortal>,C<PUSHs> and C<PUSHmortal>.=for apidoc Am|void|XPUSHp|char* str|STRLEN lenPush a string onto the stack, extending the stack if necessary. The C<len>indicates the length of the string. Handles 'set' magic. Uses C<TARG>, soC<dTARGET> or C<dXSTARG> should be called to declare it. Do not callmultiple C<TARG>-oriented macros to return lists from XSUB's - seeC<mXPUSHp> instead. See also C<PUSHp> and C<mPUSHp>.=for apidoc Am|void|XPUSHn|NV nvPush a double onto the stack, extending the stack if necessary. Handles'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called todeclare it. Do not call multiple C<TARG>-oriented macros to return listsfrom XSUB's - see C<mXPUSHn> instead. See also C<PUSHn> and C<mPUSHn>.=for apidoc Am|void|XPUSHi|IV ivPush an integer onto the stack, extending the stack if necessary. Handles'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called todeclare it. Do not call multiple C<TARG>-oriented macros to return listsfrom XSUB's - see C<mXPUSHi> instead. See also C<PUSHi> and C<mPUSHi>.=for apidoc Am|void|XPUSHu|UV uvPush an unsigned integer onto the stack, extending the stack if necessary.Handles 'set' magic. Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should becalled to declare it. Do not call multiple C<TARG>-oriented macros toreturn lists from XSUB's - see C<mXPUSHu> instead. See also C<PUSHu> andC<mPUSHu>.=for apidoc Am|void|PUSHmortalPush a new mortal SV onto the stack. The stack must have room for thiselement. Does not handle 'set' magic. Does not use C<TARG>. See alsoC<PUSHs>, C<XPUSHmortal> and C<XPUSHs>.=for apidoc Am|void|mPUSHp|char* str|STRLEN lenPush a string onto the stack. The stack must have room for this element.The C<len> indicates the length of the string. Handles 'set' magic. Doesnot use C<TARG>. See also C<PUSHp>, C<mXPUSHp> and C<XPUSHp>.=for apidoc Am|void|mPUSHn|NV nvPush a double onto the stack. The stack must have room for this element.Handles 'set' magic. Does not use C<TARG>. See also C<PUSHn>, C<mXPUSHn>and C<XPUSHn>.=for apidoc Am|void|mPUSHi|IV ivPush an integer onto the stack. The stack must have room for this element.Handles 'set' magic. Does not use C<TARG>. See also C<PUSHi>, C<mXPUSHi>and C<XPUSHi>.=for apidoc Am|void|mPUSHu|UV uvPush an unsigned integer onto the stack. The stack must have room for thiselement. Handles 'set' magic. Does not use C<TARG>. See also C<PUSHu>,C<mXPUSHu> and C<XPUSHu>.=for apidoc Am|void|XPUSHmortalPush a new mortal SV onto the stack, extending the stack if necessary. Doesnot handle 'set' magic. Does not use C<TARG>. See also C<XPUSHs>,C<PUSHmortal> and C<PUSHs>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -