3 * Copyright (c) 1991-1999, Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
10 /* This structure much match XPVCV in B/C.pm and the beginning of XPVFM
14 char * xpv_pv; /* pointer to malloced string */
15 STRLEN xpv_cur; /* length of xp_pv as a C string */
16 STRLEN xpv_len; /* allocated size */
17 IV xof_off; /* integer value */
18 NV xnv_nv; /* numeric value, if any */
19 MAGIC* xmg_magic; /* magic for scalar array */
20 HV* xmg_stash; /* class package */
25 void (*xcv_xsub) (pTHXo_ CV*);
29 long xcv_depth; /* >= 2 indicates recursive call */
33 perl_mutex *xcv_mutexp;
34 struct perl_thread *xcv_owner; /* current owner thread */
35 #endif /* USE_THREADS */
39 #define Nullcv Null(CV*)
41 #define CvSTASH(sv) ((XPVCV*)SvANY(sv))->xcv_stash
42 #define CvSTART(sv) ((XPVCV*)SvANY(sv))->xcv_start
43 #define CvROOT(sv) ((XPVCV*)SvANY(sv))->xcv_root
44 #define CvXSUB(sv) ((XPVCV*)SvANY(sv))->xcv_xsub
45 #define CvXSUBANY(sv) ((XPVCV*)SvANY(sv))->xcv_xsubany
46 #define CvGV(sv) ((XPVCV*)SvANY(sv))->xcv_gv
47 #define CvFILE(sv) ((XPVCV*)SvANY(sv))->xcv_file
48 #define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv))
49 #define CvDEPTH(sv) ((XPVCV*)SvANY(sv))->xcv_depth
50 #define CvPADLIST(sv) ((XPVCV*)SvANY(sv))->xcv_padlist
51 #define CvOUTSIDE(sv) ((XPVCV*)SvANY(sv))->xcv_outside
53 #define CvMUTEXP(sv) ((XPVCV*)SvANY(sv))->xcv_mutexp
54 #define CvOWNER(sv) ((XPVCV*)SvANY(sv))->xcv_owner
55 #endif /* USE_THREADS */
56 #define CvFLAGS(sv) ((XPVCV*)SvANY(sv))->xcv_flags
58 #define CVf_CLONE 0x0001 /* anon CV uses external lexicals */
59 #define CVf_CLONED 0x0002 /* a clone of one of those */
60 #define CVf_ANON 0x0004 /* CvGV() can't be trusted */
61 #define CVf_OLDSTYLE 0x0008
62 #define CVf_UNIQUE 0x0010 /* can't be cloned */
63 #define CVf_NODEBUG 0x0020 /* no DB::sub indirection for this CV
64 (esp. useful for special XSUBs) */
65 #define CVf_METHOD 0x0040 /* CV is explicitly marked as a method */
66 #define CVf_LOCKED 0x0080 /* CV locks itself or first arg on entry */
67 #define CVf_LVALUE 0x0100 /* CV return value can be used as lvalue */
69 #define CvCLONE(cv) (CvFLAGS(cv) & CVf_CLONE)
70 #define CvCLONE_on(cv) (CvFLAGS(cv) |= CVf_CLONE)
71 #define CvCLONE_off(cv) (CvFLAGS(cv) &= ~CVf_CLONE)
73 #define CvCLONED(cv) (CvFLAGS(cv) & CVf_CLONED)
74 #define CvCLONED_on(cv) (CvFLAGS(cv) |= CVf_CLONED)
75 #define CvCLONED_off(cv) (CvFLAGS(cv) &= ~CVf_CLONED)
77 #define CvANON(cv) (CvFLAGS(cv) & CVf_ANON)
78 #define CvANON_on(cv) (CvFLAGS(cv) |= CVf_ANON)
79 #define CvANON_off(cv) (CvFLAGS(cv) &= ~CVf_ANON)
81 #ifdef PERL_XSUB_OLDSTYLE
82 #define CvOLDSTYLE(cv) (CvFLAGS(cv) & CVf_OLDSTYLE)
83 #define CvOLDSTYLE_on(cv) (CvFLAGS(cv) |= CVf_OLDSTYLE)
84 #define CvOLDSTYLE_off(cv) (CvFLAGS(cv) &= ~CVf_OLDSTYLE)
87 #define CvUNIQUE(cv) (CvFLAGS(cv) & CVf_UNIQUE)
88 #define CvUNIQUE_on(cv) (CvFLAGS(cv) |= CVf_UNIQUE)
89 #define CvUNIQUE_off(cv) (CvFLAGS(cv) &= ~CVf_UNIQUE)
91 #define CvNODEBUG(cv) (CvFLAGS(cv) & CVf_NODEBUG)
92 #define CvNODEBUG_on(cv) (CvFLAGS(cv) |= CVf_NODEBUG)
93 #define CvNODEBUG_off(cv) (CvFLAGS(cv) &= ~CVf_NODEBUG)
95 #define CvMETHOD(cv) (CvFLAGS(cv) & CVf_METHOD)
96 #define CvMETHOD_on(cv) (CvFLAGS(cv) |= CVf_METHOD)
97 #define CvMETHOD_off(cv) (CvFLAGS(cv) &= ~CVf_METHOD)
99 #define CvLOCKED(cv) (CvFLAGS(cv) & CVf_LOCKED)
100 #define CvLOCKED_on(cv) (CvFLAGS(cv) |= CVf_LOCKED)
101 #define CvLOCKED_off(cv) (CvFLAGS(cv) &= ~CVf_LOCKED)
103 #define CvLVALUE(cv) (CvFLAGS(cv) & CVf_LVALUE)
104 #define CvLVALUE_on(cv) (CvFLAGS(cv) |= CVf_LVALUE)
105 #define CvLVALUE_off(cv) (CvFLAGS(cv) &= ~CVf_LVALUE)
107 #define CvEVAL(cv) (CvUNIQUE(cv) && !SvFAKE(cv))
108 #define CvEVAL_on(cv) (CvUNIQUE_on(cv),SvFAKE_off(cv))
109 #define CvEVAL_off(cv) CvUNIQUE_off(cv)
112 #define CvSPECIAL(cv) (CvUNIQUE(cv) && SvFAKE(cv))
113 #define CvSPECIAL_on(cv) (CvUNIQUE_on(cv),SvFAKE_on(cv))
114 #define CvSPECIAL_off(cv) (CvUNIQUE_off(cv),SvFAKE_off(cv))