source: trunk/essentials/dev-lang/perl/cv.h@ 3397

Last change on this file since 3397 was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 7.8 KB
Line 
1/* cv.h
2 *
3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
4 * 2000, 2001, 2002, 2003, 2004, by Larry Wall and others
5 *
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
8 *
9 */
10
11/* This structure must match XPVCV in B/C.pm and the beginning of XPVFM
12 * in sv.h */
13
14struct xpvcv {
15 char * xpv_pv; /* pointer to malloced string (for prototype) */
16 STRLEN xpv_cur; /* length of xp_pv as a C string */
17 STRLEN xpv_len; /* allocated size */
18 IV xof_off; /* integer value */
19 NV xnv_nv; /* numeric value, if any */
20 MAGIC* xmg_magic; /* magic for scalar array */
21 HV* xmg_stash; /* class package */
22
23 HV * xcv_stash;
24 OP * xcv_start;
25 OP * xcv_root;
26 void (*xcv_xsub) (pTHX_ CV*);
27 ANY xcv_xsubany;
28 GV * xcv_gv;
29 char * xcv_file;
30 long xcv_depth; /* >= 2 indicates recursive call */
31 PADLIST * xcv_padlist;
32 CV * xcv_outside;
33#ifdef USE_5005THREADS
34 perl_mutex *xcv_mutexp;
35 struct perl_thread *xcv_owner; /* current owner thread */
36#endif /* USE_5005THREADS */
37 cv_flags_t xcv_flags;
38 U32 xcv_outside_seq; /* the COP sequence (at the point of our
39 * compilation) in the lexically enclosing
40 * sub */
41};
42
43/*
44=head1 Handy Values
45
46=for apidoc AmU||Nullcv
47Null CV pointer.
48
49=head1 CV Manipulation Functions
50
51=for apidoc Am|HV*|CvSTASH|CV* cv
52Returns the stash of the CV.
53
54=cut
55*/
56
57#define Nullcv Null(CV*)
58
59#define CvSTASH(sv) ((XPVCV*)SvANY(sv))->xcv_stash
60#define CvSTART(sv) ((XPVCV*)SvANY(sv))->xcv_start
61#define CvROOT(sv) ((XPVCV*)SvANY(sv))->xcv_root
62#define CvXSUB(sv) ((XPVCV*)SvANY(sv))->xcv_xsub
63#define CvXSUBANY(sv) ((XPVCV*)SvANY(sv))->xcv_xsubany
64#define CvGV(sv) ((XPVCV*)SvANY(sv))->xcv_gv
65#define CvFILE(sv) ((XPVCV*)SvANY(sv))->xcv_file
66#ifdef USE_ITHREADS
67# define CvFILE_set_from_cop(sv, cop) (CvFILE(sv) = savepv(CopFILE(cop)))
68#else
69# define CvFILE_set_from_cop(sv, cop) (CvFILE(sv) = CopFILE(cop))
70#endif
71#define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv)))
72#define CvDEPTH(sv) ((XPVCV*)SvANY(sv))->xcv_depth
73#define CvPADLIST(sv) ((XPVCV*)SvANY(sv))->xcv_padlist
74#define CvOUTSIDE(sv) ((XPVCV*)SvANY(sv))->xcv_outside
75#ifdef USE_5005THREADS
76#define CvMUTEXP(sv) ((XPVCV*)SvANY(sv))->xcv_mutexp
77#define CvOWNER(sv) ((XPVCV*)SvANY(sv))->xcv_owner
78#endif /* USE_5005THREADS */
79#define CvFLAGS(sv) ((XPVCV*)SvANY(sv))->xcv_flags