This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.002gamma: utils/h2xs.PL
[perl5.git] / gv.h
CommitLineData
a0d0e21e 1/* gv.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 gp {
11 SV * gp_sv; /* scalar value */
12 U32 gp_refcnt; /* how many globs point to this? */
13 struct io * gp_io; /* filehandle value */
14 CV * gp_form; /* format value */
15 AV * gp_av; /* array value */
16 HV * gp_hv; /* associative array value */
17 GV * gp_egv; /* effective gv, if *glob */
18 CV * gp_cv; /* subroutine value */
463ee0b2 19 U32 gp_cvgen; /* generational validity of cached gv_cv */
79072805
LW
20 I32 gp_lastexpr; /* used by nothing_in_common() */
21 line_t gp_line; /* line first declared at (for -w) */
8990e307 22 GV * gp_filegv; /* file first declared in (for -w) */
79072805
LW
23 char gp_flags;
24};
25
26#if defined(CRIPPLED_CC) && (defined(iAPX286) || defined(M_I286) || defined(I80286))
27#define MICROPORT
28#endif
29
30#define GvXPVGV(gv) ((XPVGV*)SvANY(gv))
31
79072805
LW
32#define GvSV(gv) (GvGP(gv)->gp_sv)
33#define GvREFCNT(gv) (GvGP(gv)->gp_refcnt)
a0d0e21e
LW
34#define GvIO(gv) ((gv) && SvTYPE((SV*)gv) == SVt_PVGV ? GvIOp(gv) : 0)
35#define GvIOp(gv) (GvGP(gv)->gp_io)
36#define GvIOn(gv) (GvIO(gv) ? GvIOp(gv) : GvIOp(gv_IOadd(gv)))
79072805
LW
37
38#define GvFORM(gv) (GvGP(gv)->gp_form)
39#define GvAV(gv) (GvGP(gv)->gp_av)
40
41#ifdef MICROPORT /* Microport 2.4 hack */
42AV *GvAVn();
43#else
44#define GvAVn(gv) (GvGP(gv)->gp_av ? \
45 GvGP(gv)->gp_av : \
46 GvGP(gv_AVadd(gv))->gp_av)
47#endif
48#define GvHV(gv) ((GvGP(gv))->gp_hv)
49
50#ifdef MICROPORT /* Microport 2.4 hack */
51HV *GvHVn();
52#else
53#define GvHVn(gv) (GvGP(gv)->gp_hv ? \
54 GvGP(gv)->gp_hv : \
55 GvGP(gv_HVadd(gv))->gp_hv)
56#endif /* Microport 2.4 hack */
57
58#define GvCV(gv) (GvGP(gv)->gp_cv)
463ee0b2 59#define GvCVGEN(gv) (GvGP(gv)->gp_cvgen)
79072805
LW
60
61#define GvLASTEXPR(gv) (GvGP(gv)->gp_lastexpr)
62
63#define GvLINE(gv) (GvGP(gv)->gp_line)
8990e307 64#define GvFILEGV(gv) (GvGP(gv)->gp_filegv)
79072805
LW
65
66#define GvFLAGS(gv) (GvGP(gv)->gp_flags)
67
68#define GvEGV(gv) (GvGP(gv)->gp_egv)
69
70#define GvGP(gv) (GvXPVGV(gv)->xgv_gp)
71#define GvNAME(gv) (GvXPVGV(gv)->xgv_name)
72#define GvNAMELEN(gv) (GvXPVGV(gv)->xgv_namelen)
748a9306 73#define GvENAME(gv) GvNAME(GvEGV(gv) ? GvEGV(gv) : gv)
79072805
LW
74
75#define GvSTASH(gv) (GvXPVGV(gv)->xgv_stash)
748a9306 76#define GvESTASH(gv) GvSTASH(GvEGV(gv) ? GvEGV(gv) : gv)
79072805 77
79072805
LW
78#define Nullgv Null(GV*)
79
80#define DM_UID 0x003
81#define DM_RUID 0x001
82#define DM_EUID 0x002
83#define DM_GID 0x030
84#define DM_RGID 0x010
85#define DM_EGID 0x020
86#define DM_DELAY 0x100
87
a0d0e21e
LW
88#define GVf_INTRO 0x01
89#define GVf_IMPORTED 0x02
90
91#define GV_ADD 0x01
92#define GV_ADDMULTI 0x02
93#define GV_ADDWARN 0x04