📄 op.h
字号:
#define PMf_EVAL 0x0400 /* evaluating replacement as expr *//* The following flags have exact equivalents in regcomp.h with the prefix RXf_ * which are stored in the regexp->extflags member. */#define PMf_LOCALE 0x00800 /* use locale for character types */#define PMf_MULTILINE 0x01000 /* assume multiple lines */#define PMf_SINGLELINE 0x02000 /* assume single line */#define PMf_FOLD 0x04000 /* case insensitivity */#define PMf_EXTENDED 0x08000 /* chuck embedded whitespace */#define PMf_KEEPCOPY 0x10000 /* copy the string when matching *//* mask of bits that need to be transfered to re->extflags */#define PMf_COMPILETIME (PMf_MULTILINE|PMf_SINGLELINE|PMf_LOCALE|PMf_FOLD|PMf_EXTENDED|PMf_KEEPCOPY)#ifdef USE_ITHREADS# define PmopSTASHPV(o) \ (((o)->op_pmflags & PMf_ONCE) ? (o)->op_pmstashstartu.op_pmstashpv : NULL)# if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)# define PmopSTASHPV_set(o,pv) ({ \ assert((o)->op_pmflags & PMf_ONCE); \ ((o)->op_pmstashstartu.op_pmstashpv = savesharedpv(pv)); \ })# else# define PmopSTASHPV_set(o,pv) \ ((o)->op_pmstashstartu.op_pmstashpv = savesharedpv(pv))# endif# define PmopSTASH(o) (PmopSTASHPV(o) \ ? gv_stashpv((o)->op_pmstashstartu.op_pmstashpv,GV_ADD) : NULL)# define PmopSTASH_set(o,hv) PmopSTASHPV_set(o, ((hv) ? HvNAME_get(hv) : NULL))# define PmopSTASH_free(o) PerlMemShared_free(PmopSTASHPV(o))#else# define PmopSTASH(o) \ (((o)->op_pmflags & PMf_ONCE) ? (o)->op_pmstashstartu.op_pmstash : NULL)# if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)# define PmopSTASH_set(o,hv) ({ \ assert((o)->op_pmflags & PMf_ONCE); \ ((o)->op_pmstashstartu.op_pmstash = (hv)); \ })# else# define PmopSTASH_set(o,hv) ((o)->op_pmstashstartu.op_pmstash = (hv))# endif# define PmopSTASHPV(o) (PmopSTASH(o) ? HvNAME_get(PmopSTASH(o)) : NULL) /* op_pmstashstartu.op_pmstash is not refcounted */# define PmopSTASHPV_set(o,pv) PmopSTASH_set((o), gv_stashpv(pv,GV_ADD))/* Note that if this becomes non-empty, then S_forget_pmop in op.c will need changing */# define PmopSTASH_free(o) #endifstruct svop { BASEOP SV * op_sv;};struct padop { BASEOP PADOFFSET op_padix;};struct pvop { BASEOP char * op_pv;};struct loop { BASEOP OP * op_first; OP * op_last; OP * op_redoop; OP * op_nextop; OP * op_lastop;};#define cUNOPx(o) ((UNOP*)o)#define cBINOPx(o) ((BINOP*)o)#define cLISTOPx(o) ((LISTOP*)o)#define cLOGOPx(o) ((LOGOP*)o)#define cPMOPx(o) ((PMOP*)o)#define cSVOPx(o) ((SVOP*)o)#define cPADOPx(o) ((PADOP*)o)#define cPVOPx(o) ((PVOP*)o)#define cCOPx(o) ((COP*)o)#define cLOOPx(o) ((LOOP*)o)#define cUNOP cUNOPx(PL_op)#define cBINOP cBINOPx(PL_op)#define cLISTOP cLISTOPx(PL_op)#define cLOGOP cLOGOPx(PL_op)#define cPMOP cPMOPx(PL_op)#define cSVOP cSVOPx(PL_op)#define cPADOP cPADOPx(PL_op)#define cPVOP cPVOPx(PL_op)#define cCOP cCOPx(PL_op)#define cLOOP cLOOPx(PL_op)#define cUNOPo cUNOPx(o)#define cBINOPo cBINOPx(o)#define cLISTOPo cLISTOPx(o)#define cLOGOPo cLOGOPx(o)#define cPMOPo cPMOPx(o)#define cSVOPo cSVOPx(o)#define cPADOPo cPADOPx(o)#define cPVOPo cPVOPx(o)#define cCOPo cCOPx(o)#define cLOOPo cLOOPx(o)#define kUNOP cUNOPx(kid)#define kBINOP cBINOPx(kid)#define kLISTOP cLISTOPx(kid)#define kLOGOP cLOGOPx(kid)#define kPMOP cPMOPx(kid)#define kSVOP cSVOPx(kid)#define kPADOP cPADOPx(kid)#define kPVOP cPVOPx(kid)#define kCOP cCOPx(kid)#define kLOOP cLOOPx(kid)#ifdef USE_ITHREADS# define cGVOPx_gv(o) ((GV*)PAD_SVl(cPADOPx(o)->op_padix))# define IS_PADGV(v) (v && SvTYPE(v) == SVt_PVGV && isGV_with_GP(v) \ && GvIN_PAD(v))# define IS_PADCONST(v) (v && SvREADONLY(v))# define cSVOPx_sv(v) (cSVOPx(v)->op_sv \ ? cSVOPx(v)->op_sv : PAD_SVl((v)->op_targ))# define cSVOPx_svp(v) (cSVOPx(v)->op_sv \ ? &cSVOPx(v)->op_sv : &PAD_SVl((v)->op_targ))#else# define cGVOPx_gv(o) ((GV*)cSVOPx(o)->op_sv)# define IS_PADGV(v) FALSE# define IS_PADCONST(v) FALSE# define cSVOPx_sv(v) (cSVOPx(v)->op_sv)# define cSVOPx_svp(v) (&cSVOPx(v)->op_sv)#endif#define cGVOP_gv cGVOPx_gv(PL_op)#define cGVOPo_gv cGVOPx_gv(o)#define kGVOP_gv cGVOPx_gv(kid)#define cSVOP_sv cSVOPx_sv(PL_op)#define cSVOPo_sv cSVOPx_sv(o)#define kSVOP_sv cSVOPx_sv(kid)#define Nullop Null(OP*)/* Lowest byte-and-a-bit of PL_opargs */#define OA_MARK 1#define OA_FOLDCONST 2#define OA_RETSCALAR 4#define OA_TARGET 8#define OA_RETINTEGER 16#define OA_OTHERINT 32#define OA_DANGEROUS 64#define OA_DEFGV 128#define OA_TARGLEX 256/* The next 4 bits encode op class information */#define OCSHIFT 9#define OA_CLASS_MASK (15 << OCSHIFT)#define OA_BASEOP (0 << OCSHIFT)#define OA_UNOP (1 << OCSHIFT)#define OA_BINOP (2 << OCSHIFT)#define OA_LOGOP (3 << OCSHIFT)#define OA_LISTOP (4 << OCSHIFT)#define OA_PMOP (5 << OCSHIFT)#define OA_SVOP (6 << OCSHIFT)#define OA_PADOP (7 << OCSHIFT)#define OA_PVOP_OR_SVOP (8 << OCSHIFT)#define OA_LOOP (9 << OCSHIFT)#define OA_COP (10 << OCSHIFT)#define OA_BASEOP_OR_UNOP (11 << OCSHIFT)#define OA_FILESTATOP (12 << OCSHIFT)#define OA_LOOPEXOP (13 << OCSHIFT)#define OASHIFT 13/* Remaining nybbles of PL_opargs */#define OA_SCALAR 1#define OA_LIST 2#define OA_AVREF 3#define OA_HVREF 4#define OA_CVREF 5#define OA_FILEREF 6#define OA_SCALARREF 7#define OA_OPTIONAL 8/* Op_REFCNT is a reference count at the head of each op tree: needed * since the tree is shared between threads, and between cloned closure * copies in the same thread. OP_REFCNT_LOCK/UNLOCK is used when modifying * this count. * The same mutex is used to protect the refcounts of the reg_trie_data * and reg_ac_data structures, which are shared between duplicated * regexes. */#ifdef USE_ITHREADS# define OP_REFCNT_INIT MUTEX_INIT(&PL_op_mutex)# ifdef PERL_CORE# define OP_REFCNT_LOCK MUTEX_LOCK(&PL_op_mutex)# define OP_REFCNT_UNLOCK MUTEX_UNLOCK(&PL_op_mutex)# else# define OP_REFCNT_LOCK op_refcnt_lock()# define OP_REFCNT_UNLOCK op_refcnt_unlock()# endif# define OP_REFCNT_TERM MUTEX_DESTROY(&PL_op_mutex)#else# define OP_REFCNT_INIT NOOP# define OP_REFCNT_LOCK NOOP# define OP_REFCNT_UNLOCK NOOP# define OP_REFCNT_TERM NOOP#endif#define OpREFCNT_set(o,n) ((o)->op_targ = (n))#ifdef PERL_DEBUG_READONLY_OPS# define OpREFCNT_inc(o) Perl_op_refcnt_inc(aTHX_ o)# define OpREFCNT_dec(o) Perl_op_refcnt_dec(aTHX_ o)#else# define OpREFCNT_inc(o) ((o) ? (++(o)->op_targ, (o)) : NULL)# define OpREFCNT_dec(o) (--(o)->op_targ)#endif/* flags used by Perl_load_module() */#define PERL_LOADMOD_DENY 0x1#define PERL_LOADMOD_NOIMPORT 0x2#define PERL_LOADMOD_IMPORT_OPS 0x4#if defined(PERL_IN_PERLY_C) || defined(PERL_IN_OP_C)#define ref(o, type) doref(o, type, TRUE)#endif/* no longer used anywhere in core */#ifndef PERL_CORE#define cv_ckproto(cv, gv, p) \ cv_ckproto_len((cv), (gv), (p), (p) ? strlen(p) : 0)#endif#ifdef USE_REENTRANT_API#include "reentr.h"#endif#if defined(PL_OP_SLAB_ALLOC)#define NewOp(m,var,c,type) \ (var = (type *) Perl_Slab_Alloc(aTHX_ c*sizeof(type)))#define NewOpSz(m,var,size) \ (var = (OP *) Perl_Slab_Alloc(aTHX_ size))#define FreeOp(p) Perl_Slab_Free(aTHX_ p)#else#define NewOp(m, var, c, type) \ (var = (MEM_WRAP_CHECK_(c,type) \ (type*)PerlMemShared_calloc(c, sizeof(type))))#define NewOpSz(m, var, size) \ (var = (OP*)PerlMemShared_calloc(1, size))#define FreeOp(p) PerlMemShared_free(p)#endif#ifdef PERL_MAD# define MAD_NULL 1# define MAD_PV 2# define MAD_OP 3# define MAD_SV 4struct madprop { MADPROP* mad_next; const void *mad_val; U32 mad_vlen;/* short mad_count; */ char mad_key; char mad_type;};struct token { I32 tk_type; YYSTYPE tk_lval; MADPROP* tk_mad;};#endif/* * Values that can be held by mad_key : * ^ unfilled head spot * , literal , * ; literal ; (blank if implicit ; at end of block) * : literal : from ?: or attr list * + unary + * ? literal ? from ?: * ( literal ( * ) literal ) * [ literal [ * ] literal ] * { literal { * } literal } * @ literal @ sigil * $ literal $ sigil * * literal * sigil * ! use is source filtered * & & or sub * # whitespace/comment following ; or } * # $# sigil * 1 1st ; from for(;;) * 1 retired protasis * 2 2nd ; from for(;;) * 2 retired apodosis * 3 C-style for list * a sub or var attributes * a non-method arrow operator * A method arrow operator * A use import args * b format block * B retired stub block * C constant conditional op * d declarator * D do block * e unreached "else" (see C) * e expression producing E * E tr/E/R/, /E/ * f folded constant op * F peg op for format * g op was forced to be a word * i if/unless modifier * I if/elsif/unless statement * k local declarator * K retired kid op * l last index of array ($#foo) * L label * m modifier on regex * n sub or format name * o current operator/declarator name * o else/continue * O generic optimized op * p peg to hold extra whitespace at statement level * P peg op for package declaration * q opening quote * = quoted material * Q closing quote * Q optimized qw// * r expression producing R * R tr/E/R/ s/E/R/ * s sub signature * S use import stub (no import) * S retired sort block * t unreached "then" (see C) * U use import op * v private sv of for loop * V use version * w while/until modifier * W while/for statement * x optimized qw * X random thing * _ whitespace/comments preceding anything else * ~ =~ operator *//* * Local variables: * c-indentation-style: bsd * c-basic-offset: 4 * indent-tabs-mode: t * End: * * ex: set ts=8 sts=4 sw=4 noet: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -