This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.002
[perl5.git] / cv.h
CommitLineData
a0d0e21e 1/* cv.h
79072805 2 *
a0d0e21e 3 * Copyright (c) 1991-1994, Larry Wall
79072805
LW
4 *
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.
7 *
79072805
LW
8 */
9
10struct xpvcv {
11 char * xpv_pv; /* pointer to malloced string */
12 STRLEN xpv_cur; /* length of xp_pv as a C string */
13 STRLEN xpv_len; /* allocated size */
a0d0e21e 14 IV xof_off; /* integer value */
79072805
LW
15 double xnv_nv; /* numeric value, if any */
16 MAGIC* xmg_magic; /* magic for scalar array */
17 HV* xmg_stash; /* class package */
18
19 HV * xcv_stash;
20 OP * xcv_start;
21 OP * xcv_root;
a0d0e21e
LW
22 void (*xcv_xsub) _((CV*));
23 ANY xcv_xsubany;
8990e307 24 GV * xcv_gv;
79072805
LW
25 GV * xcv_filegv;
26 long xcv_depth; /* >= 2 indicates recursive call */
27 AV * xcv_padlist;
748a9306 28 CV * xcv_outside;
a5f75d66 29 U8 xcv_flags;
79072805 30};
748a9306 31
79072805 32#define Nullcv Null(CV*)
a5f75d66 33
79072805
LW
34#define CvSTASH(sv) ((XPVCV*)SvANY(sv))->xcv_stash
35#define CvSTART(sv) ((XPVCV*)SvANY(sv))->xcv_start
36#define CvROOT(sv) ((XPVCV*)SvANY(sv))->xcv_root
a0d0e21e
LW
37#define CvXSUB(sv) ((XPVCV*)SvANY(sv))->xcv_xsub
38#define CvXSUBANY(sv) ((XPVCV*)SvANY(sv))->xcv_xsubany
8990e307 39#define CvGV(sv) ((XPVCV*)SvANY(sv))->xcv_gv
79072805
LW
40#define CvFILEGV(sv) ((XPVCV*)SvANY(sv))->xcv_filegv
41#define CvDEPTH(sv) ((XPVCV*)SvANY(sv))->xcv_depth
42#define CvPADLIST(sv) ((XPVCV*)SvANY(sv))->xcv_padlist
748a9306 43#define CvOUTSIDE(sv) ((XPVCV*)SvANY(sv))->xcv_outside
a5f75d66
AD
44#define CvFLAGS(sv) ((XPVCV*)SvANY(sv))->xcv_flags
45
46#define CVf_CLONE 0x01 /* anon CV uses external lexicals */
47#define CVf_CLONED 0x02 /* a clone of one of those */
48#define CVf_ANON 0x04 /* CvGV() can't be trusted */
49#define CVf_OLDSTYLE 0x08
50
51#define CvCLONE(cv) (CvFLAGS(cv) & CVf_CLONE)
52#define CvCLONE_on(cv) (CvFLAGS(cv) |= CVf_CLONE)
53#define CvCLONE_off(cv) (CvFLAGS(cv) &= ~CVf_CLONE)
54
55#define CvCLONED(cv) (CvFLAGS(cv) & CVf_CLONED)
56#define CvCLONED_on(cv) (CvFLAGS(cv) |= CVf_CLONED)
57#define CvCLONED_off(cv) (CvFLAGS(cv) &= ~CVf_CLONED)
58
59#define CvANON(cv) (CvFLAGS(cv) & CVf_ANON)
60#define CvANON_on(cv) (CvFLAGS(cv) |= CVf_ANON)
61#define CvANON_off(cv) (CvFLAGS(cv) &= ~CVf_ANON)
79072805 62
a5f75d66
AD
63#define CvOLDSTYLE(cv) (CvFLAGS(cv) & CVf_OLDSTYLE)
64#define CvOLDSTYLE_on(cv) (CvFLAGS(cv) |= CVf_OLDSTYLE)
65#define CvOLDSTYLE_off(cv) (CvFLAGS(cv) &= ~CVf_OLDSTYLE)