This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[dummy merge]
[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
44a8e56a
PP
10/* This structure much match the beginning of XPVFM */
11
79072805
LW
12struct xpvcv {
13 char * xpv_pv; /* pointer to malloced string */
14 STRLEN xpv_cur; /* length of xp_pv as a C string */
15 STRLEN xpv_len; /* allocated size */
a0d0e21e 16 IV xof_off; /* integer value */
79072805
LW
17 double xnv_nv; /* numeric value, if any */
18 MAGIC* xmg_magic; /* magic for scalar array */
19 HV* xmg_stash; /* class package */
20
21 HV * xcv_stash;
22 OP * xcv_start;
23 OP * xcv_root;
a0d0e21e
LW
24 void (*xcv_xsub) _((CV*));
25 ANY xcv_xsubany;
8990e307 26 GV * xcv_gv;
79072805
LW
27 GV * xcv_filegv;
28 long xcv_depth; /* >= 2 indicates recursive call */
29 AV * xcv_padlist;
748a9306 30 CV * xcv_outside;
a5f75d66 31 U8 xcv_flags;
79072805 32};
748a9306 33
79072805 34#define Nullcv Null(CV*)
a5f75d66 35
79072805
LW
36#define CvSTASH(sv) ((XPVCV*)SvANY(sv))->xcv_stash
37#define CvSTART(sv) ((XPVCV*)SvANY(sv))->xcv_start
38#define CvROOT(sv) ((XPVCV*)SvANY(sv))->xcv_root
a0d0e21e
LW
39#define CvXSUB(sv) ((XPVCV*)SvANY(sv))->xcv_xsub
40#define CvXSUBANY(sv) ((XPVCV*)SvANY(sv))->xcv_xsubany
8990e307 41#define CvGV(sv) ((XPVCV*)SvANY(sv))->xcv_gv
79072805
LW
42#define CvFILEGV(sv) ((XPVCV*)SvANY(sv))->xcv_filegv
43#define CvDEPTH(sv) ((XPVCV*)SvANY(sv))->xcv_depth
44#define CvPADLIST(sv) ((XPVCV*)SvANY(sv))->xcv_padlist
748a9306 45#define CvOUTSIDE(sv) ((XPVCV*)SvANY(sv))->xcv_outside
a5f75d66
AD
46#define CvFLAGS(sv) ((XPVCV*)SvANY(sv))->xcv_flags
47
48#define CVf_CLONE 0x01 /* anon CV uses external lexicals */
49#define CVf_CLONED 0x02 /* a clone of one of those */
50#define CVf_ANON 0x04 /* CvGV() can't be trusted */
51#define CVf_OLDSTYLE 0x08
07055b4c 52#define CVf_UNIQUE 0x10 /* can't be cloned */
8ebc5c01
PP
53#define CVf_NODEBUG 0x20 /* no DB::sub indirection for this CV
54 (esp. useful for special XSUBs) */
a5f75d66
AD
55
56#define CvCLONE(cv) (CvFLAGS(cv) & CVf_CLONE)
57#define CvCLONE_on(cv) (CvFLAGS(cv) |= CVf_CLONE)
58#define CvCLONE_off(cv) (CvFLAGS(cv) &= ~CVf_CLONE)
59
60#define CvCLONED(cv) (CvFLAGS(cv) & CVf_CLONED)
61#define CvCLONED_on(cv) (CvFLAGS(cv) |= CVf_CLONED)
62#define CvCLONED_off(cv) (CvFLAGS(cv) &= ~CVf_CLONED)
63
64#define CvANON(cv) (CvFLAGS(cv) & CVf_ANON)
65#define CvANON_on(cv) (CvFLAGS(cv) |= CVf_ANON)
66#define CvANON_off(cv) (CvFLAGS(cv) &= ~CVf_ANON)
79072805 67
a5f75d66
AD
68#define CvOLDSTYLE(cv) (CvFLAGS(cv) & CVf_OLDSTYLE)
69#define CvOLDSTYLE_on(cv) (CvFLAGS(cv) |= CVf_OLDSTYLE)
70#define CvOLDSTYLE_off(cv) (CvFLAGS(cv) &= ~CVf_OLDSTYLE)
07055b4c
CS
71
72#define CvUNIQUE(cv) (CvFLAGS(cv) & CVf_UNIQUE)
73#define CvUNIQUE_on(cv) (CvFLAGS(cv) |= CVf_UNIQUE)
74#define CvUNIQUE_off(cv) (CvFLAGS(cv) &= ~CVf_UNIQUE)
8ebc5c01
PP
75
76#define CvNODEBUG(cv) (CvFLAGS(cv) & CVf_NODEBUG)
77#define CvNODEBUG_on(cv) (CvFLAGS(cv) |= CVf_NODEBUG)
78#define CvNODEBUG_off(cv) (CvFLAGS(cv) &= ~CVf_NODEBUG)